migrate transaction statistics page to composition API and typescript

This commit is contained in:
MaysWind
2025-01-25 14:52:57 +08:00
parent 8207373a05
commit a27a2556aa
7 changed files with 1316 additions and 1272 deletions
+12 -2
View File
@@ -1,4 +1,4 @@
import type { TypeAndDisplayName } from '@/core/base.ts';
import type { TypeAndName, TypeAndDisplayName } from '@/core/base.ts';
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
export function isFunction(val: unknown): val is Function {
@@ -37,7 +37,7 @@ export function isBoolean(val: unknown): val is boolean {
return typeof(val) === 'boolean';
}
export function isYearMonth(val: unknown): boolean {
export function isYearMonth(val: unknown): val is string {
if (!isString(val)) {
return false;
}
@@ -312,6 +312,16 @@ export function getItemByKeyValue<T>(src: Record<string, T>[] | Record<string, R
return null;
}
export function findNameByType(items: TypeAndName[], type: number): string | null {
for (const item of items) {
if (item.type === type) {
return item.name;
}
}
return null;
}
export function findDisplayNameByType(items: TypeAndDisplayName[], type: number): string | null {
for (const item of items) {
if (item.type === type) {