import { TFormConfig } from '../config/getFormConfig'; import { JSX } from 'vue/jsx-runtime'; export interface IConRenderOp { ctx: import('vue').SetupContext<["activateConF", "removeF", "moveF"]>; /** 表单配置 */ formConfig: TFormConfig; /** 父控件 */ parent?: BaseCon; cons?: BaseCon[]; /** 当前激活的对象 */ activateCon?: BaseCon; /** 表单数据,只有render表单的时候才会传这个值 */ formData?: Record; } export interface IConRightRenderOp { ctx: import('vue').SetupContext; /** 表单配置 */ formConfig: TFormConfig; cons?: BaseCon[]; } export interface IConRightRenderItemOp { key: K; title: string; childs: ({ label?: string | JSX.Element; editor?: JSX.Element; } | undefined)[]; } export type BaseRightRenderK = "com"; /** * 基类控件 */ export declare class BaseCon { /** 单例对象 */ static I?: BaseCon; /** 控件类型 */ static ConType: string; /** 控件名字 */ static ConName: string; /** 控件类型 */ readonly conType: string; /** 控件名字 */ readonly conName: string; /** 控件实例唯一的key,不可变的 */ readonly key: string; /** 渲染key */ renderKey: string; /** 子控件 */ childs: BaseCon[]; /** 是否可拖拽 */ protected towable: boolean; /** 是否隐藏 */ hide: boolean; constructor(); /** 转JSON字符串 */ toJSON(): this; /** * 初始化配置 * TODO 主要是把一些配置转成class实例 * @param config 配置信息 * @param toCons 转换成cons的方法 * @returns */ initConfig(config: any, toCons: (config: any[], econs?: (typeof BaseCon)[]) => BaseCon[]): this; /** * 初始化 * 因为有两种方式初始化,一种是new,一种是initConfig 所以这里统一一下 * @param config initConfig 调用时回传的参数 */ init(config?: any): void; /** * 更新渲染key * TODO 强制更新组件时调用此方法 */ upadteRenderKey(): this; /** 获取子控件列表 */ getChild(): BaseCon[]; /** * 设置组件隐藏 * @param b */ setHide(b?: boolean): this; /** * 渲染拖拽时显示的元素 * @param op */ renderDrag(op: IConRenderOp): JSX.Element | undefined; /** * 顶层渲染方法 * @param {RenderOp} op * @returns */ render({ ctx, activateCon, formData, parent, }: IConRenderOp): JSX.Element | undefined; /** * 获取顶层渲染方法的handler元素 * @param op */ getHandler({ ctx }: IConRenderOp): JSX.Element[]; /** * 渲染中间件 * TODO 负责分离顶层渲染和底层渲染方法 * @param op * @returns */ renderMiddleware(op: IConRenderOp): JSX.Element; /** * 最底层渲染方法 * @param op */ renderRaw(op: IConRenderOp): JSX.Element; /** * 渲染右边编辑栏目 * @param op * @returns */ renderRight(op: IConRightRenderOp): JSX.Element[]; /** * 获取右侧编辑栏默认展开的栏目 */ getRightDefaultExpanded(): (RightRenderK | BaseRightRenderK)[]; /** * 获取右边编辑栏目 * @param op * @param hasEditor 是否获取编辑器 * @returns */ getRight(op: IConRightRenderOp): IConRightRenderItemOp[]; /** * 通过key查找某个控件实例 * @param list * @param key */ static findCon(list: BaseCon[], key: string | ((o: BaseCon) => boolean)): BaseCon | undefined; /** * 组件遍历,并返回所有的组件 * @param list * @param f */ static consForeach(list: BaseCon[], f?: (item: BaseCon, i: number) => void): BaseCon[]; /** * 插入控件 * @param list * @param key * @param con * @param type */ static insertCon(list: BaseCon[], key: string, con: BaseCon, type?: "up" | "down"): void; /** * 移动控件 * @param list * @param con * @param type */ static moveCon(list: BaseCon[], con: BaseCon, type: "up" | "down"): void; /** 获取唯一的key */ static getKey(): string; /** 获取唯一哈希值 */ static getHash(): string; }