🐛 日期单元格值设置不上

This commit is contained in:
Vanessa 2023-08-02 12:02:34 +08:00
parent 12d399dce9
commit e3315a1dd1
4 changed files with 12 additions and 11 deletions

View file

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

View file

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

View file

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

View file

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