An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: https://github.com/siyuan-note/siyuan/issues/8664
Vanessabee5ff9d4f0b
diff --git a/app/src/protyle/render/av/filter.ts b/app/src/protyle/render/av/filter.tsindex 2e223fa938..26fb38b091 100644--- a/app/src/protyle/render/av/filter.ts+++ b/app/src/protyle/render/av/filter.ts@@ -10,6 +10,7 @@ export const getCellValue = (colType: TAVCol, value: string) => {if (colType === "number") {if (value) {cellValue = {+ type: colType,number: {content: parseFloat(value),isNotEmpty: true@@ -17,6 +18,7 @@ export const getCellValue = (colType: TAVCol, value: string) => {};} else {cellValue = {+ type: colType,number: {isNotEmpty: false}@@ -24,12 +26,14 @@ export const getCellValue = (colType: TAVCol, value: string) => {}} else if (colType === "text") {cellValue = {+ type: colType,text: {content: value}};} else if (colType === "mSelect" || colType === "select") {cellValue = {+ type: colType,mSelect: [{content: value,color: ""@@ -45,12 +49,11 @@ export const setFilter = (options: {data: IAV,target: HTMLElement,}) => {- const colType = Object.keys(options.filter.value)[0] as TAVCol;const rectTarget = options.target.getBoundingClientRect();const menu = new Menu("set-filter-" + options.filter.column, () => {const oldFilters = JSON.parse(JSON.stringify(options.data.view.filters));let hasMatch = false;- const cellValue = getCellValue(colType, textElement?.value || "");+ const cellValue = getCellValue(options.filter.value.type, textElement?.value || "");const newFilter: IAVFilter = {column: options.filter.column,value: cellValue,@@ -91,7 +94,7 @@ export const setFilter = (options: {}let selectHTML = "";let colData: IAVColumn;- switch (colType) {+ switch (options.filter.value.type) {case "text":selectHTML = `<option ${"=" === options.filter.operator ? "selected" : ""} value="=">${window.siyuan.languages.filterOperatorIs}</option><option ${"!=" === options.filter.operator ? "selected" : ""} value="!=">${window.siyuan.languages.filterOperatorIsNot}</option>@@ -140,7 +143,7 @@ export const setFilter = (options: {iconHTML: "",label: `<select style="margin: 4px 0" class="b3-select fn__size200">${selectHTML}</select>`});- if (colType === "mSelect") {+ if (options.filter.value.type === "mSelect") {// TODOcolData.options.forEach((option) => {menu.addItem({@@ -150,12 +153,12 @@ export const setFilter = (options: {}});});- } else if (colType === "text") {+ } else if (options.filter.value.type === "text") {menu.addItem({iconHTML: "",label: `<input style="margin: 4px 0" value="${options.filter.value.text.content}" class="b3-text-field fn__size200">`});- } else if (colType === "number") {+ } else if (options.filter.value.type === "number") {menu.addItem({iconHTML: "",label: `<input style="margin: 4px 0" value="${options.filter.value.number.isNotEmpty ? options.filter.value.number.content : ""}" class="b3-text-field fn__size200">`diff --git a/app/src/protyle/render/av/openMenuPanel.ts b/app/src/protyle/render/av/openMenuPanel.tsindex 0ca0f0c85d..2f5407e58c 100644--- a/app/src/protyle/render/av/openMenuPanel.ts+++ b/app/src/protyle/render/av/openMenuPanel.ts@@ -484,7 +484,7 @@ export const openMenuPanel = (protyle: IProtyle,event.stopPropagation();break;} else if (type === "removeSelectCell") {- removeSelectCell(protyle, data.view, options, target.parentElement);+ removeSelectCell(protyle, data, options, target.parentElement);event.stopPropagation();break;}diff --git a/app/src/protyle/render/av/select.ts b/app/src/protyle/render/av/select.tsindex f934e69412..603ff64a1e 100644--- a/app/src/protyle/render/av/select.ts+++ b/app/src/protyle/render/av/select.ts@@ -42,7 +42,7 @@ const filterSelectHTML = (key: string, options: { name: string, color: string }[return html;};-export const removeSelectCell = (protyle: IProtyle, data: IAVTable, options: {+export const removeSelectCell = (protyle: IProtyle, data: IAV, options: {cellElement: HTMLElement}, target: HTMLElement) => {if (!target) {@@ -52,7 +52,7 @@ export const removeSelectCell = (protyle: IProtyle, data: IAVTable, options: {const colId = options.cellElement.dataset.colId;const cellId = options.cellElement.dataset.id;let colData: IAVColumn;- data.columns.find((item: IAVColumn) => {+ data.view.columns.find((item: IAVColumn) => {if (item.id === colId) {colData = item;return;@@ -62,7 +62,7 @@ export const removeSelectCell = (protyle: IProtyle, data: IAVTable, options: {colData.options = [];}let cellData: IAVCell;- data.rows.find(row => {+ data.view.rows.find(row => {if (row.id === rowID) {row.cells.find(cell => {if (cell.id === cellId) {@@ -342,7 +342,9 @@ export const bindSelectEvent = (protyle: IProtyle, data: IAV, menuElement: HTMLE}addSelectColAndCell(protyle, data, options, currentElement, menuElement);} else if (event.key === "Backspace" && inputElement.value === "") {- removeSelectCell(protyle, data.view, options, inputElement.previousElementSibling as HTMLElement);+ removeSelectCell(protyle, data, options, inputElement.previousElementSibling as HTMLElement);+ } else if (event.key === "Escape") {+ menuElement.parentElement.remove();}});};@@ -381,7 +383,7 @@ export const addSelectColAndCell = (protyle: IProtyle, data: IAV, options: {if (!cellData) {cellData = {color: "",- bgColor:"",+ bgColor: "",id: Lute.NewNodeID(),value: {mSelect: []diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.tsindex af44aec7da..f4c8babc39 100644--- a/app/src/types/index.d.ts+++ b/app/src/types/index.d.ts@@ -912,6 +912,7 @@ interface IAVCell {}interface IAVCellValue {+ type?: TAVCol,text?: { content: string },number?: { content?: number, isNotEmpty: boolean },mSelect?: { content: string, color: string }[]