mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-20 16:40:13 +01:00
🚨
This commit is contained in:
parent
46e395189d
commit
ecb413660f
3 changed files with 8 additions and 9 deletions
|
|
@ -5,13 +5,13 @@ import {Menu} from "../../../plugin/Menu";
|
||||||
|
|
||||||
export const getCalcValue = (column: IAVColumn) => {
|
export const getCalcValue = (column: IAVColumn) => {
|
||||||
if (!column.calc || !column.calc.result) {
|
if (!column.calc || !column.calc.result) {
|
||||||
return ""
|
return "";
|
||||||
}
|
}
|
||||||
const resultCalc = column.calc.result.number
|
const resultCalc = column.calc.result.number;
|
||||||
let value = "";
|
let value = "";
|
||||||
switch (column.calc.operator) {
|
switch (column.calc.operator) {
|
||||||
case "Count all":
|
case "Count all":
|
||||||
value = `<span>${resultCalc.content}</span>${window.siyuan.languages.calcResultCountAll}`
|
value = `<span>${resultCalc.content}</span>${window.siyuan.languages.calcResultCountAll}`;
|
||||||
break;
|
break;
|
||||||
case "Count values":
|
case "Count values":
|
||||||
value = `<span>${resultCalc.content}</span>${window.siyuan.languages.calcResultCountValues}`;
|
value = `<span>${resultCalc.content}</span>${window.siyuan.languages.calcResultCountValues}`;
|
||||||
|
|
@ -51,7 +51,7 @@ export const getCalcValue = (column: IAVColumn) => {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
};
|
||||||
|
|
||||||
export const genCellValue = (colType: TAVCol, value: string | {
|
export const genCellValue = (colType: TAVCol, value: string | {
|
||||||
content: string,
|
content: string,
|
||||||
|
|
@ -132,7 +132,7 @@ const calcItem = (options: {
|
||||||
}]);
|
}]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
export const openCalcMenu = (protyle: IProtyle, calcElement: HTMLElement) => {
|
export const openCalcMenu = (protyle: IProtyle, calcElement: HTMLElement) => {
|
||||||
const blockElement = hasClosestBlock(calcElement);
|
const blockElement = hasClosestBlock(calcElement);
|
||||||
if (!blockElement) {
|
if (!blockElement) {
|
||||||
|
|
@ -279,7 +279,7 @@ export const openCalcMenu = (protyle: IProtyle, calcElement: HTMLElement) => {
|
||||||
}
|
}
|
||||||
const calcRect = calcElement.getBoundingClientRect();
|
const calcRect = calcElement.getBoundingClientRect();
|
||||||
menu.open({x: calcRect.left, y: calcRect.bottom, h: calcRect.height});
|
menu.open({x: calcRect.left, y: calcRect.bottom, h: calcRect.height});
|
||||||
}
|
};
|
||||||
|
|
||||||
export const popTextCell = (protyle: IProtyle, cellElement: HTMLElement) => {
|
export const popTextCell = (protyle: IProtyle, cellElement: HTMLElement) => {
|
||||||
const type = cellElement.parentElement.parentElement.firstElementChild.querySelector(`[data-col-id="${cellElement.getAttribute("data-col-id")}"]`).getAttribute("data-dtype") as TAVCol;
|
const type = cellElement.parentElement.parentElement.firstElementChild.querySelector(`[data-col-id="${cellElement.getAttribute("data-col-id")}"]`).getAttribute("data-dtype") as TAVCol;
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ export const avRender = (element: Element, cb?: () => void) => {
|
||||||
const data = response.data.view as IAVTable;
|
const data = response.data.view as IAVTable;
|
||||||
// header
|
// header
|
||||||
let tableHTML = '<div class="av__row av__row--header"><div class="av__firstcol"><svg style="height: 32px"><use xlink:href="#iconUncheck"></use></svg></div>';
|
let tableHTML = '<div class="av__row av__row--header"><div class="av__firstcol"><svg style="height: 32px"><use xlink:href="#iconUncheck"></use></svg></div>';
|
||||||
let calcHTML = ''
|
let calcHTML = "";
|
||||||
data.columns.forEach((column: IAVColumn) => {
|
data.columns.forEach((column: IAVColumn) => {
|
||||||
if (column.hidden) {
|
if (column.hidden) {
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ import {transaction} from "../../wysiwyg/transaction";
|
||||||
import {hasClosestByClassName} from "../../util/hasClosest";
|
import {hasClosestByClassName} from "../../util/hasClosest";
|
||||||
import {confirmDialog} from "../../../dialog/confirmDialog";
|
import {confirmDialog} from "../../../dialog/confirmDialog";
|
||||||
import {upDownHint} from "../../../util/upDownHint";
|
import {upDownHint} from "../../../util/upDownHint";
|
||||||
import {genCellValue} from "./cell";
|
|
||||||
|
|
||||||
const filterSelectHTML = (key: string, options: { name: string, color: string }[]) => {
|
const filterSelectHTML = (key: string, options: { name: string, color: string }[]) => {
|
||||||
let html = "";
|
let html = "";
|
||||||
|
|
@ -361,7 +360,7 @@ export const addSelectColAndCell = (protyle: IProtyle, data: IAV, options: {
|
||||||
cellIndex = index;
|
cellIndex = index;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
let colData: IAVColumn;
|
let colData: IAVColumn;
|
||||||
data.view.columns.find((item: IAVColumn) => {
|
data.view.columns.find((item: IAVColumn) => {
|
||||||
if (item.id === colId) {
|
if (item.id === colId) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue