mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-22 16:26:09 +01:00
This commit is contained in:
parent
491fa58d99
commit
d9bfc45592
1 changed files with 14 additions and 19 deletions
|
|
@ -427,7 +427,18 @@ export const addColOptionOrCell = (protyle: IProtyle, data: IAV, cellElements: H
|
|||
const nodeElement = hasClosestBlock(cellElements[0]);
|
||||
if (!nodeElement) {
|
||||
cellElements.forEach((item, index) => {
|
||||
cellElements[index] = blockElement.querySelector(`.av__cell[data-id="${item.dataset.id}"]`) as HTMLElement;
|
||||
const rowElement = hasClosestByClassName(item, "av__row");
|
||||
if (rowElement) {
|
||||
let cellIndex: number;
|
||||
rowElement.querySelectorAll(".av__cell").forEach((cellElement: HTMLElement, ghostIndex) => {
|
||||
if (cellElement.dataset.id === item.dataset.id) {
|
||||
cellIndex = ghostIndex
|
||||
}
|
||||
});
|
||||
if (typeof cellIndex === "number") {
|
||||
cellElements[index] = blockElement.querySelectorAll(`.av__row[data-id="${rowElement.dataset.id}"] .av__cell`)[cellIndex] as HTMLElement;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
const colId = cellElements[0].dataset.colId;
|
||||
|
|
@ -545,25 +556,9 @@ export const getSelectHTML = (data: IAVTable, cellElements: HTMLElement[]) => {
|
|||
}
|
||||
});
|
||||
|
||||
let allUniqueOptions: IAVCellSelectValue[] = [];
|
||||
data.rows.find(row => {
|
||||
const rowElement = hasClosestByClassName(cellElements[0], "av__row");
|
||||
if (rowElement && rowElement.dataset.id === row.id) {
|
||||
row.cells.find(cell => {
|
||||
if (cell.id === cellElements[0].dataset.id) {
|
||||
if (cell.value && cell.value.mSelect) {
|
||||
allUniqueOptions = cell.value.mSelect;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
let selectedHTML = "";
|
||||
allUniqueOptions.forEach((unique) => {
|
||||
selectedHTML += `<div class="b3-chip b3-chip--middle" data-content="${escapeAttr(unique.content)}" style="background-color:var(--b3-font-background${unique.color});color:var(--b3-font-color${unique.color})">${unique.content}<svg class="b3-chip__close" data-type="removeCellOption"><use xlink:href="#iconCloseRound"></use></svg></div>`;
|
||||
genCellValueByElement(colData.type, cellElements[0]).mSelect?.forEach((item) => {
|
||||
selectedHTML += `<div class="b3-chip b3-chip--middle" data-content="${escapeAttr(item.content)}" style="background-color:var(--b3-font-background${item.color});color:var(--b3-font-color${item.color})">${item.content}<svg class="b3-chip__close" data-type="removeCellOption"><use xlink:href="#iconCloseRound"></use></svg></div>`;
|
||||
});
|
||||
|
||||
return `<div class="b3-menu__items">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue