import { ComponentType } from "react"; import { BaseInfoType } from "../interface"; import { ComponentController } from "./component-controller"; import { compsConfig } from "./assets"; export default class ComponentDefinition { private componentType: string; // 组件类型 private componentNode: ComponentType; // 组件实例 constructor({ componentType, componentNode }) { this.componentType = componentType; this.componentNode = componentNode; } getBaseInfo(): BaseInfoType { return compsConfig[this.componentType].baseInfo; } getController(): any | null { return new ComponentController({ componentNode: this.componentNode, componentType: this.componentType }); } }