From 80f1c6c3ec48c472885949b46cfc35b1366c22de Mon Sep 17 00:00:00 2001 From: Vanessa Date: Fri, 5 Sep 2025 23:37:58 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/15609 --- app/src/protyle/render/av/filter.ts | 27 +++++++++++++++++++-------- app/src/types/index.d.ts | 1 + 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/app/src/protyle/render/av/filter.ts b/app/src/protyle/render/av/filter.ts index ca8588ce7..c80dfb0c2 100644 --- a/app/src/protyle/render/av/filter.ts +++ b/app/src/protyle/render/av/filter.ts @@ -85,8 +85,7 @@ export const setFilter = async (options: { const blockID = options.blockElement.getAttribute("data-node-id"); const menu = new Menu("set-filter-" + options.filter.column, () => { const oldFilters = JSON.parse(JSON.stringify(options.data.view.filters)); - const selectElement = menu.element.querySelector(".b3-select") as HTMLSelectElement; - if (!selectElement || !selectElement.value) { + if (!operationElement || !operationElement.value) { return; } const newFilter: IAVFilter = { @@ -94,7 +93,7 @@ export const setFilter = async (options: { value: { type: options.filter.value.type }, - operator: selectElement.value as TAVFilterOperator + operator: operationElement.value as TAVFilterOperator }; let hasMatch = false; let newValue; @@ -156,6 +155,7 @@ export const setFilter = async (options: { }, type: "rollup" }; + newFilter.quantifier = (menu.element.querySelector('.b3-select[data-type="quantifier"]') as HTMLSelectElement).value; } else { newFilter.value = newValue; } @@ -349,10 +349,21 @@ export const setFilter = async (options: { `; break; } + if (options.filter.value.type === "rollup") { + menu.addItem({ + iconHTML: "", + type: "readonly", + label: ` ` + }); + } menu.addItem({ iconHTML: "", type: "readonly", - label: `` + label: `` }); if (filterValue.type === "select" || filterValue.type === "mSelect") { if (colData.options?.length > 0) { @@ -519,9 +530,9 @@ export const setFilter = async (options: { } } }); - const selectElement = (menu.element.querySelector(".b3-select") as HTMLSelectElement); - selectElement.addEventListener("change", () => { - toggleEmpty(selectElement, selectElement.value, filterValue.type); + const operationElement = (menu.element.querySelector('.b3-select[data-type="operation"]') as HTMLSelectElement); + operationElement.addEventListener("change", () => { + toggleEmpty(operationElement, operationElement.value, filterValue.type); }); const dateTypeElement = menu.element.querySelector('.b3-select[data-type="dateType"]') as HTMLSelectElement; dateTypeElement?.addEventListener("change", () => { @@ -570,7 +581,7 @@ export const setFilter = async (options: { }); }); } - toggleEmpty(selectElement, selectElement.value, filterValue.type); + toggleEmpty(operationElement, operationElement.value, filterValue.type); menu.open({x: rectTarget.left, y: rectTarget.bottom}); if (textElements.length > 0) { textElements[0].select(); diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.ts index fc3843061..70981f32a 100644 --- a/app/src/types/index.d.ts +++ b/app/src/types/index.d.ts @@ -897,6 +897,7 @@ interface IAVGallery extends IAVView { interface IAVFilter { column: string, operator: TAVFilterOperator, + quantifier?: string, value: IAVCellValue, relativeDate?: relativeDate relativeDate2?: relativeDate