Просмотр исходного кода

:bug: 日期单元格值设置不上

Vanessa 2 лет назад
Родитель
Сommit
e3315a1dd1

+ 3 - 5
app/src/protyle/render/av/date.ts

@@ -63,6 +63,7 @@ export const bindDateEvent = (options: {
             data: options.data,
             protyle: options.protyle,
             value: {
+                isNotEmpty: inputElements[0].value !== "",
                 content: new Date(inputElements[0].value).getTime()
             }
         });
@@ -73,6 +74,7 @@ export const bindDateEvent = (options: {
             data: options.data,
             protyle: options.protyle,
             value: {
+                isNotEmpty2: inputElements[1].value !== "",
                 content2: new Date(inputElements[1].value).getTime()
             }
         });
@@ -99,11 +101,7 @@ export const setDateValue = (options: {
     cellElements: HTMLElement[],
     data: IAV
     protyle: IProtyle,
-    value: {
-        content?: number,
-        content2?: number,
-        hasEndDate?: boolean
-    }
+    value: IAVCellDateValue
 }) => {
     let cellIndex = 0;
     Array.from(options.cellElements[0].parentElement.querySelectorAll(".av__cell")).find((item: HTMLElement, index) => {

+ 3 - 2
app/src/protyle/render/av/filter.ts

@@ -11,7 +11,7 @@ export const getDefaultOperatorByType = (type: TAVCol) => {
     if (type === "number" || type === "select") {
         return "=";
     }
-    if (type === "text" || type === "mSelect" || type === "url") {
+    if (["text", "mSelect", "url", "block"].includes(type)) {
         return "Contains";
     }
 };
@@ -133,6 +133,7 @@ export const setFilter = (options: {
         }
     });
     switch (colData.type) {
+        case "block":
         case "text":
         case "url":
             selectHTML = `<option ${"=" === options.filter.operator ? "selected" : ""} value="=">${window.siyuan.languages.filterOperatorIs}</option>
@@ -208,7 +209,7 @@ export const setFilter = (options: {
                 }
             });
         });
-    } else if (colData.type === "text" || colData.type === "url") {
+    } else if (["text", "url", "block"].includes(colData.type)) {
         menu.addItem({
             iconHTML: "",
             label: `<input style="margin: 4px 0" value="${options.filter.value?.text.content || ""}" class="b3-text-field fn__size200">`

+ 4 - 2
app/src/protyle/render/av/openMenuPanel.ts

@@ -621,8 +621,10 @@ export const openMenuPanel = (options: {
                         data,
                         protyle: options.protyle,
                         value: {
-                            content: 0,
-                            content2: 0,
+                            isNotEmpty2: false,
+                            isNotEmpty: false,
+                            content: null,
+                            content2: null,
                             hasEndDate: false
                         }
                     });

+ 2 - 2
app/src/types/index.d.ts

@@ -937,8 +937,8 @@ interface IAVCellValue {
 
 interface IAVCellDateValue {
     content?: number,
-    isNotEmpty: boolean
+    isNotEmpty?: boolean
     content2?: number,
-    isNotEmpty2: boolean
+    isNotEmpty2?: boolean
     hasEndDate?: boolean
 }