🎨 The database supports calculating the "Percent unique values" of the field https://github.com/siyuan-note/siyuan/issues/13192

This commit is contained in:
Daniel 2024-11-20 20:20:41 +08:00
parent 36df3d5ea1
commit 1e28680a58
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
15 changed files with 289 additions and 20 deletions

View file

@ -208,6 +208,17 @@ export const openCalcMenu = async (protyle: IProtyle, calcElement: HTMLElement,
blockID,
target: calcElement
});
calcItem({
menu,
protyle,
colId,
avId,
oldOperator,
operator: "Percent unique values",
data: panelData?.data,
blockID,
target: calcElement
});
} else {
calcItem({
menu,
@ -427,6 +438,9 @@ export const getCalcValue = (column: IAVColumn) => {
case "Percent not empty":
value = `<span>${resultCalc.formattedContent}</span>${window.siyuan.languages.calcResultPercentNotEmpty}`;
break;
case "Percent unique values":
value = `<span>${resultCalc.formattedContent}</span>${window.siyuan.languages.calcResultPercentUniqueValues}`;
break;
case "Sum":
value = `<span>${resultCalc.formattedContent}</span>${window.siyuan.languages.calcResultSum}`;
break;
@ -486,6 +500,8 @@ export const getNameByOperator = (operator: string, isRollup: boolean) => {
return window.siyuan.languages.calcOperatorPercentEmpty;
case "Percent not empty":
return window.siyuan.languages.calcOperatorPercentNotEmpty;
case "Percent unique values":
return window.siyuan.languages.calcOperatorPercentUniqueValues;
case "Checked":
return window.siyuan.languages.checked;
case "Unchecked":