support filtering accounts and transaction categories for overview in home page (#209)

This commit is contained in:
MaysWind
2025-09-07 13:57:07 +08:00
parent 3ae72623ad
commit ce9378c43f
33 changed files with 459 additions and 53 deletions
+16
View File
@@ -415,6 +415,22 @@ export function objectFieldToArrayItem(object: object): string[] {
return ret;
}
export function objectFieldWithValueToArrayItem<T>(object: Record<string, T>, value: T): string[] {
const ret: string[] = [];
for (const field in object) {
if (!Object.prototype.hasOwnProperty.call(object, field)) {
continue;
}
if (object[field] === value) {
ret.push(field);
}
}
return ret;
}
export function arrayItemToObjectField<T>(array: string[], value: T): Record<string, T> {
const ret: Record<string, T> = {};