import { VNode } from "vue"; export enum Type { html = "html", svg = "svg" // three = "three", // chart = "chart", // graph = "graph", // node = "node" } // 生命周期 export enum HookType { beforeCreate = "beforeCreate", // 创建实体对象 el 前 created = "created", // 创建实体对象 el 后 beforeMount = "beforeMount", mounted = "mounted", // 挂载 render = "render", // 渲染 beforeUpdate = "beforeUpdate", // 渲染之前 updated = "updated", // 渲染后 beforeDestroy = "beforeDestroy", destroyed = "destroyed" } export interface Options { uid: string; // 唯一ID // type: "html" | "svg" | "three" | "chart" | string; // 类型: 普通html、svg、threejs、echart、自定义的组件 url: string; // remote远程地址 or 默认内置的名称 key: string; // 组件关键字 label: string; // 组件名称 visible: boolean; // 显示隐藏 locked: boolean; // 是否锁定 attribute: Record; // 属性:例如dom元素的id、class、src style: Record; // 样式 props: Record; // 组件扩展的属性 children: Array; source: Array; // 数据源 slot: boolean; // 是否支持添加子组件 } type ExtensionAttribute = | VNode | { tag: string; // 标签名 key: string; // 属性索引key label: string; // 属性名 defaultValue?: any; // 默认值 options: Record; // tooltip?: string; // 提示语 // placeholder?: string; // input select 所需 change?: (value: T) => T; // 自定义事件(值修改时触发) }; type ExtensionStyle = | VNode | { tag: string; // 标签名 key: string; // 样式key label: string; // 属性名 defaultValue?: any; // 默认值 options: Record; // tooltip?: string; // 提示语 // placeholder?: string; // input select 所需 change?: (value: T) => T; // 自定义事件(值修改时触发) }; type ExtensionSource = { key: string; // 数据源的key from: "static" | "interface"; data: any; }; /** * 组件的扩展参数 */ export type Extension = | { attribute?: Array; style?: Array; source?: Record; props?: Record; slot: boolean; // 是否支持子节点 } | ((props: Record) => Extension);