use the new popup select dialog

This commit is contained in:
MaysWind
2025-03-09 16:23:23 +08:00
parent 2bf8c0b501
commit 639bd9c5cd
12 changed files with 473 additions and 191 deletions
+11 -1
View File
@@ -1,4 +1,4 @@
import type { TypeAndName, TypeAndDisplayName } from '@/core/base.ts';
import type { NameValue, TypeAndName, TypeAndDisplayName} from '@/core/base.ts';
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
export function isFunction(val: unknown): val is Function {
@@ -303,6 +303,16 @@ export function getItemByKeyValue<T>(src: Record<string, T>[] | Record<string, R
return null;
}
export function findNameByValue(items: NameValue[], value: string): string | null {
for (const item of items) {
if (item.value === value) {
return item.name;
}
}
return null;
}
export function findNameByType(items: TypeAndName[], type: number): string | null {
for (const item of items) {
if (item.type === type) {