feat:提交

This commit is contained in:
2025-07-22 18:22:31 +08:00
parent 160bb294ca
commit 2ebb3e1abe
85 changed files with 36380 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
import 'reflect-metadata'
export const jsonOptionMataDataKey = Symbol('JsonOptions')
export enum JsonOptionType
{
Ignore = 0,
Property = 1,
}
export class JsonOption
{
constructor(type: JsonOptionType, data: any = null)
{
this.type = type
this.data = data
}
type: JsonOptionType
data: any
}
export function jsonProperty(key: string | number)
{
return Reflect.metadata(jsonOptionMataDataKey, new JsonOption(JsonOptionType.Property, { key }))
}
export function jsonIgnore()
{
return Reflect.metadata(jsonOptionMataDataKey, new JsonOption(JsonOptionType.Ignore))
}

View File

@@ -0,0 +1,39 @@
import 'reflect-metadata'
const displayMetadataKey = Symbol('display')
export function display(
name: string,
group: string = '',
type: string = 'color',
)
{
return Reflect.metadata(displayMetadataKey, {
name,
group,
type,
})
}
export function getDisplayInfo(target: any)
{
let keys = Object.getOwnPropertyNames(target)
let list = []
keys.forEach((key) =>
{
let info = <{ name: string; group: string; type: number }>(
Reflect.getMetadata(displayMetadataKey, target, key)
)
if (info)
{
info
list.push({
prop: key,
name: info.name,
group: info.group,
type: info.type,
})
}
})
return list
}