mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-17 16:24:25 +08:00
use the new popup select dialog
This commit is contained in:
+11
-1
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user