migrate signup page to composition API and typescript

This commit is contained in:
MaysWind
2025-01-19 22:13:06 +08:00
parent 019c993313
commit 92df98c3fb
8 changed files with 496 additions and 499 deletions
+12
View File
@@ -1,3 +1,5 @@
import type { TypeAndDisplayName } from '@/core/base.ts';
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
export function isFunction(val: unknown): val is Function {
return typeof(val) === 'function';
@@ -310,6 +312,16 @@ export function getItemByKeyValue<T>(src: Record<string, T>[] | Record<string, R
return null;
}
export function findDisplayNameByType(items: TypeAndDisplayName[], type: number): string | null {
for (const item of items) {
if (item.type === type) {
return item.displayName;
}
}
return null;
}
export function getNameByKeyValue<V, N>(src: Record<string, N | V>[] | Record<string, Record<string, N | V>>, value: V, keyField: string | null, nameField: string, defaultName?: N): N | undefined {
if (isArray(src)) {
const arr = src as Record<string, N | V>[];