mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 09:30:14 +01:00
This commit is contained in:
parent
63a69a9eb8
commit
479d14e6a2
2 changed files with 33 additions and 15 deletions
|
|
@ -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, [{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue