mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-23 10:00:13 +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));
|
const oldFilters = JSON.parse(JSON.stringify(options.data.filters));
|
||||||
options.data.filters.find((filter) => {
|
options.data.filters.find((filter) => {
|
||||||
if (filter.column === options.filter.column) {
|
if (filter.column === options.filter.column) {
|
||||||
filter.value[colType] = {
|
let cellValue: IAVCellValue;
|
||||||
|
if (colType === "number") {
|
||||||
|
if (textElement.value) {
|
||||||
|
cellValue = {
|
||||||
|
content: parseFloat(textElement.value),
|
||||||
|
isNotEmpty: true
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
cellValue = {}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
cellValue = {
|
||||||
content: textElement.value
|
content: textElement.value
|
||||||
};
|
}
|
||||||
|
}
|
||||||
|
filter.value[colType] = cellValue;
|
||||||
filter.operator = (window.siyuan.menus.menu.element.querySelector(".b3-select") as HTMLSelectElement).value as TAVFilterOperator;
|
filter.operator = (window.siyuan.menus.menu.element.querySelector(".b3-select") as HTMLSelectElement).value as TAVFilterOperator;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -663,13 +676,15 @@ const addFilter = (options: {
|
||||||
icon: getColIconByType(column.type),
|
icon: getColIconByType(column.type),
|
||||||
click: () => {
|
click: () => {
|
||||||
const oldFilters = Object.assign([], options.data.filters);
|
const oldFilters = Object.assign([], options.data.filters);
|
||||||
|
let cellValue = {}
|
||||||
|
if (column.type !== "number") {
|
||||||
|
cellValue = {content: ""}
|
||||||
|
}
|
||||||
options.data.filters.push({
|
options.data.filters.push({
|
||||||
column: column.id,
|
column: column.id,
|
||||||
operator: "Contains",
|
operator: "Contains",
|
||||||
value: {
|
value: {
|
||||||
[column.type]: {
|
[column.type]: cellValue
|
||||||
content: ""
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
transaction(options.protyle, [{
|
transaction(options.protyle, [{
|
||||||
|
|
|
||||||
15
app/src/types/index.d.ts
vendored
15
app/src/types/index.d.ts
vendored
|
|
@ -851,7 +851,9 @@ interface IAV {
|
||||||
interface IAVFilter {
|
interface IAVFilter {
|
||||||
column: string,
|
column: string,
|
||||||
operator: TAVFilterOperator,
|
operator: TAVFilterOperator,
|
||||||
value: IAVCellValue
|
value: {
|
||||||
|
[key in TAVCol]?: IAVCellValue
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IAVSort {
|
interface IAVSort {
|
||||||
|
|
@ -878,15 +880,16 @@ interface IAVCell {
|
||||||
id: string,
|
id: string,
|
||||||
color: string,
|
color: string,
|
||||||
bgColor: string,
|
bgColor: string,
|
||||||
value: IAVCellValue,
|
value: {
|
||||||
|
[key in TAVCol]?: IAVCellValue
|
||||||
|
},
|
||||||
valueType: TAVCol,
|
valueType: TAVCol,
|
||||||
}
|
}
|
||||||
|
|
||||||
type IAVCellValue = {
|
interface IAVCellValue {
|
||||||
[key in TAVCol]?: {
|
content?: any
|
||||||
content: string
|
|
||||||
content2?: string
|
content2?: string
|
||||||
color?: string
|
color?: string
|
||||||
id?: string
|
id?: string
|
||||||
}
|
isNotEmpty?: boolean
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue