Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: https://github.com/siyuan-note/siyuan/issues/8664

Vanessa479d14e6a2bf
diff --git a/app/src/protyle/render/av/openMenuPanel.ts b/app/src/protyle/render/av/openMenuPanel.ts
index 8cad4d4f7b..07a93fc018 100644
--- a/app/src/protyle/render/av/openMenuPanel.ts
+++ b/app/src/protyle/render/av/openMenuPanel.ts
@@ -564,9 +564,22 @@ export const setFilter = (options: {
const oldFilters = JSON.parse(JSON.stringify(options.data.filters));
options.data.filters.find((filter) => {
if (filter.column === options.filter.column) {
- filter.value[colType] = {
- content: textElement.value
- };
+ let cellValue: IAVCellValue;
+ if (colType === "number") {
+ if (textElement.value) {
+ cellValue = {
+ content: parseFloat(textElement.value),
+ isNotEmpty: true
+ }
+ } else {
+ cellValue = {}
+ }
+ } else {
+ cellValue = {
+ content: textElement.value
+ }
+ }
+ filter.value[colType] = cellValue;
filter.operator = (window.siyuan.menus.menu.element.querySelector(".b3-select") as HTMLSelectElement).value as TAVFilterOperator;
return true;
}
@@ -663,13 +676,15 @@ const addFilter = (options: {
icon: getColIconByType(column.type),
click: () => {
const oldFilters = Object.assign([], options.data.filters);
+ let cellValue = {}
+ if (column.type !== "number") {
+ cellValue = {content: ""}
+ }
options.data.filters.push({
column: column.id,
operator: "Contains",
value: {
- [column.type]: {
- content: ""
- }
+ [column.type]: cellValue
},
});
transaction(options.protyle, [{
diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.ts
index 2878794841..4951f5ea5c 100644
--- a/app/src/types/index.d.ts
+++ b/app/src/types/index.d.ts
@@ -851,7 +851,9 @@ interface IAV {
interface IAVFilter {
column: string,
operator: TAVFilterOperator,
- value: IAVCellValue
+ value: {
+ [key in TAVCol]?: IAVCellValue
+ },
}
interface IAVSort {
@@ -878,15 +880,16 @@ interface IAVCell {
id: string,
color: string,
bgColor: string,
- value: IAVCellValue,
+ value: {
+ [key in TAVCol]?: IAVCellValue
+ },
valueType: TAVCol,
}
-type IAVCellValue = {
- [key in TAVCol]?: {
- content: string
- content2?: string
- color?: string
- id?: string
- }
+interface IAVCellValue {
+ content?: any
+ content2?: string
+ color?: string
+ id?: string
+ isNotEmpty?: boolean
}