import { Dictionary, Predicate, Type } from './base'; /** * 注册控件定义 * @param categoryDef 控件定义 */ export declare function registerAddonCategory(categoryDef: AddonCategoryDef): void; /** * 属性类型 * inplace属性由控件自行编辑,,如果是inplace类型,则对象初始化时就应当创建 */ export declare const PropertyType: { hidden: string; simple: string; object: string; list: string; map: string; inplace: string; }; /** * 控件配置(用于创建控件的配置) */ export interface Config { /** * 编辑器类型 */ $type?: string; } /** * 组件定义 */ export interface AddonDef { /** * 类型 */ type?: string; /** * 标题 */ title?: string; /** * 描述 */ description?: string; /** * 属性定义 */ propertyDefs?: Dictionary; /** * 编辑器对象类型 */ componentType?: any; /** * 属性 */ defaultProps?: Dictionary; /** * 对象编辑器 */ editors?: Dictionary; /** * 图标 */ icon?: string; /** * 图片 */ picture?: string; /** * 扩展属性 */ [key: string]: any; } export interface AddonCategoryDef { /** * 类型名称 */ name: string; /** * 标题 */ title: string; /** * 图标 */ icon?: string; /** * 过滤器 */ filter?: Predicate; } export declare function registerAddon(objectDef: AddonDef): void; /** * 根据编辑器类别获取编辑器定义 ` * @param category 编辑器类别 */ export declare function findAddonDefs(filter?: Predicate): AddonDef[]; /** * 根据编辑器类别获取编辑器定义 * @param category 编辑器类别 */ export declare function getAddonDefsByCategory(category: string): AddonDef[]; export declare function getAddonDefByType(type: string): AddonDef; /** * 获取编辑器默认属性 * @param $type 编辑器名称 */ export declare function getAddonDefaultProps($type: string): Dictionary | undefined; export declare function isFunctionString(config: any): boolean; /** * 执行配置中的函数形式的值,配置中的函数用'()=>'开头,要引用其他属性,可以用:self. * @param config 配置 */ export declare function __calcConfigValue(parentConfig: any, config: any): any; export declare function calcConfigString(parentConfig: any, config: any, data: any): any; /** 计算一层 */ export declare function calcConfigValue(config: any, data?: any): any; /** * 根据配置创建控件 * @param config 配置 */ export declare function createAddonByConfig(config?: any, createChildren?: boolean): any; /** * 根据字典的配置列表创建控件 * @param config 配置 */ export declare function createAddonByConfigDict(configs: Dictionary, extendProps?: any): Dictionary; /** * 注册控件定义 * @param categoryDef 控件定义 */ export declare function findAddonCategories(categoryDef?: Predicate): AddonCategoryDef[]; /** * 获取类别 * @param addonDefs 插件定义 */ export declare function getCategoryDef(categoryName: string): AddonCategoryDef; /** * 获取类别 * @param addonDefs 插件定义 */ export declare function getCategories(addonDefs?: AddonDef[]): AddonCategoryDef[]; /** * 通过类别列表获取插件定义 * @param addonDefs 插件定义 */ export declare function findAddonDefsInCategories(categoryNames?: string[]): AddonDef[]; /***************************以下是对象定义***************************/ /** * 装饰器:插件类型 * @description 用此装饰过的插件类型会将构造函数以及插件的名称和描述等添加到插件类型列表中,便于检索 * @author pao */ export declare function addon(objDef: AddonDef): (target: any) => void; /** * 编辑器 * @param addonType 插件类型 */ export declare function getEditorsFromType(addonType: string): any; /** * 装饰器:插件类型 * @description 用此装饰过的插件类型会将构造函数以及插件的名称和描述等添加到插件类型列表中,便于检索 * @author pao */ export declare function property(propDef: PropertyDef): (target: any, propName: string) => void; /** * 工厂,所有工厂接口 * @description 用于创建对象的工厂 * @author pao */ export interface IFactory { /** * 创建对象 * @description 工厂创建的对象的方法 * @returns {Object | undefined} 创建的对象 */ getValue?(): Object | undefined; } export declare class Addon implements Config { /** * 类型 */ $type?: string; binders?: DataBinder[]; static bindDataAndEvents(data: BindArgs, binders?: DataBinder[] | DataBinder): void; constructor(); } /** * 代理工厂 * @description 通过代理方式实现的工厂 * @extends {BaseAddon} * @interface IFactory * @author pao */ export declare class ProxyFactory extends Addon { destObject?: Object | Type | undefined; /** * 内部对象 * @type {any} */ protected innerObject?: any; /** * 构造方法 * @param {Type|Object} destObject? 目标对象 */ constructor(destObject?: Object | Type | undefined); /** * 代理方法 * @description 这是一个可以重写的方法,此方法的作用是根据名称调用方法并返回值 * @param {string} methodName 方法名称 * @param {any} args 函数参数 * @returns {any} 方法返回值 */ proxyMethod?(methodName: string, args: any): any; /** * 创建对象 * @description 通过代理创建对象 * @returns {Object | undefined} 创建的对象 */ getValue?(): Object | undefined; } export declare class LinkItem extends Addon { itemPath?: string; /** * 获取项目值 * @param rootObject 根对象 */ getItemValue?(rootObject: any): T; } export declare class PropertyDef extends Addon { title?: string; description?: string; propertyType?: keyof typeof PropertyType; editor?: any; elementType?: string; elementCategories?: string[]; showInTree?: boolean; icon?: string; } /** * 从枚举中获取选项列表 */ export declare function createOptionListFromEnum(enumObj: any): { value: string; title: string; }[]; /** * 根据编辑器类型获取OptionList */ export declare function createOptionListByAddonCategory(category?: string): { value: string | undefined; title: string; }[]; export declare function isAddon(type: Type, props: any): props is T; export declare function isAddonConfig(type: Type, props: any): boolean; export declare class Binder extends Addon { bind?: ((data: BindArgs) => void) | undefined; } export declare class DataProvider extends Addon { value: any; getData?: (() => any) | undefined; } export interface BindArgs { props: Addon; [index: string]: any; } export declare class DataBinder extends Binder { valueFunction?: string; dataProviders?: Dictionary; bind?: ((data: BindArgs) => void) | undefined; } /** * 根据对象类型创建对象 * @param objectType 对象类型 */ export declare function createNewObjectByType(objectType?: string): Date | "" | 0 | { $type: string; } | undefined; export declare class Factory extends Addon { getObject?: (() => T | undefined) | undefined; } /** * 创建对象 * @param originObj 原始对象 */ export declare function create(originObj?: FactType): T; export declare function getObject(originObj?: Config | Factory | Factory[] | Dictionary | any): T; /** * 全局资源列表 */ export declare const GlobalResourceList: Dictionary; export declare class ResourceFactory extends Factory { resourceId?: string; constructor(); getObject?: (() => T) | undefined; } export declare type FactType = Factory | T;