feat: midway注解方式编写插件

This commit is contained in:
xiaojunnuo
2023-01-11 20:39:48 +08:00
parent 52522f27e9
commit dcd1023a39
47 changed files with 484 additions and 714 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ export type AccessInputDefine = FormItemProps & {
required?: boolean;
};
export type AccessDefine = Registrable & {
inputs?: {
input?: {
[key: string]: AccessInputDefine;
};
};
@@ -20,7 +20,7 @@ export function IsAccess(define: AccessDefine): ClassDecorator {
inputs[property] = input;
}
}
_.merge(define, { inputs });
_.merge(define, { input: inputs });
Reflect.defineMetadata(ACCESS_CLASS_KEY, define, target);
target.define = define;
accessRegistry.register(define.name, {
@@ -30,9 +30,9 @@ export function IsAccess(define: AccessDefine): ClassDecorator {
};
}
export function IsAccessInput(input?: AccessInputDefine): PropertyDecorator {
export function AccessInput(input?: AccessInputDefine): PropertyDecorator {
return (target, propertyKey) => {
target = Decorator.target(target);
target = Decorator.target(target, propertyKey);
// const _type = Reflect.getMetadata("design:type", target, propertyKey);
Reflect.defineMetadata(ACCESS_INPUT_KEY, input, target, propertyKey);
};