epic-designer-cjh
Version:
基于vue3的设计器,可视化开发页面表单
258 lines (257 loc) • 9.48 kB
TypeScript
import { type NodeItem, type SchemaGroupItem } from '../../core/types/epic-designer';
export interface ActivitybarModel {
id: string;
title: string;
icon: string;
component: any;
}
export interface RightSidebarModel {
id: string;
title: string;
component: any;
}
export interface ViewsContainersModel {
activitybars: ActivitybarModel[];
rightSidebars: RightSidebarModel[];
}
export type Components = Record<string, any>;
export interface EventModel {
type: string;
describe: string;
}
export interface ActionModel extends EventModel {
argsConfigs?: NodeItem[];
args?: any[];
}
export interface ComponentConfigModel {
component: any;
defaultSchema: NodeItem;
config: {
attribute?: NodeItem[];
style?: NodeItem[];
event?: EventModel[];
action?: ActionModel[];
};
bindModel?: string;
}
export type ComponentConfigModelRecords = Record<string, ComponentConfigModel>;
export interface MethodModel {
describe?: string;
methodName: string;
method: (...args: any[]) => any;
}
export type PublicMethodsModel = Record<string, MethodModel>;
export interface SchemaGroup {
list: NodeItem[];
title: string;
}
export type SchemaGroupList = SchemaGroup[];
export declare class PluginManager {
components: Components;
componentConfigs: ComponentConfigModelRecords;
schemaGroup: SchemaGroupItem[];
schemaGroupList: import("vue").Ref<{
list: {
[x: string]: any;
type: string;
label?: string | undefined;
field?: string | undefined;
name?: string | undefined;
slotName?: string | undefined;
componentProps?: any;
id?: string | undefined;
rules?: {
[x: string]: any;
trigger?: string | string[] | undefined;
required?: boolean | undefined;
type?: string | undefined;
pattern?: string | {
exec: (string: string) => RegExpExecArray | null;
test: (string: string) => boolean;
readonly source: string;
readonly global: boolean;
readonly ignoreCase: boolean;
readonly multiline: boolean;
lastIndex: number;
compile: (pattern: string, flags?: string | undefined) => RegExp;
readonly flags: string;
readonly sticky: boolean;
readonly unicode: boolean;
readonly dotAll: boolean;
readonly hasIndices: boolean;
[Symbol.match]: (string: string) => RegExpMatchArray | null;
[Symbol.replace]: {
(string: string, replaceValue: string): string;
(string: string, replacer: (substring: string, ...args: any[]) => string): string;
};
[Symbol.search]: (string: string) => number;
[Symbol.split]: (string: string, limit?: number | undefined) => string[];
[Symbol.matchAll]: (str: string) => IterableIterator<RegExpMatchArray>;
} | undefined;
min?: number | undefined;
max?: number | undefined;
len?: number | undefined;
enum?: (string | number | boolean | null | undefined)[] | undefined;
whitespace?: boolean | undefined;
validator?: string | undefined;
isValidator?: boolean | undefined;
message?: string | ((a?: string | undefined) => string) | undefined;
}[] | undefined;
noFormItem?: boolean | undefined;
input?: boolean | undefined;
immovable?: boolean | undefined;
childImmovable?: boolean | undefined;
labelCol?: any;
wrapperCol?: any;
children?: any[] | undefined;
slots?: {
[slotName: string]: NodeItem[];
} | undefined;
show?: boolean | ((renderCallbackParams: import('../../core/types/epic-designer').RenderCallbackParams) => boolean) | undefined;
editData?: any;
}[];
title: string;
}[]>;
viewsContainers: ViewsContainersModel;
publicMethods: PublicMethodsModel;
/**
* 添加组件到插件管理器中
* @param componentName 组件名称
* @param component 组件
*/
component(componentName: string, component: any): void;
/**
* 注册组件到插件管理器中
* @param component 组件
* @param schema 组件结构
* @param attrSchemas 属性结构
* @param bindModel 双向绑定value
*/
registerComponent(componentConfig: ComponentConfigModel): void;
/**
* 获取所有插件管理中的所有组件
* @returns components
*/
getComponents(): Components;
/**
* 通过type 查询相应的组件
* @returns components
*/
getComponent(type: string): any;
/**
* 注册活动栏
*/
registerActivitybar(activitybar: ActivitybarModel): void;
/**
* 获取所有activitybars
* @returns activitybars
*/
getActivitybars(): ActivitybarModel[];
/**
* 注册右侧栏
*/
registerRightSidebar(rightSidebar: RightSidebarModel): void;
/**
* 获取所有rightSidebars
* @returns rightSidebars
*/
getRightSidebars(): RightSidebarModel[];
/**
* 获取所有插件管理中的所有组件配置
* @returns componentAttrs
*/
getComponentConfings(): ComponentConfigModelRecords;
/**
* 通过type获取ComponentConfing
* @returns
*/
getComponentConfingByType(type: string): ComponentConfigModel;
/**
* 设置分组,这个操作将会覆盖原来的数据
* @param {*} schemaGroup
* @returns
*/
setSchemaGroup(schemaGroup: SchemaGroupItem[]): void;
/**
* 添加分组
* @param {*} schemaGroupItem
* @returns
*/
addSchemaGroup(schemaGroupItem: SchemaGroupItem): void;
/**
* 计算schemaGroupList
*/
computedSchemaGroupList(): void;
/**
* 按照分组获取schemaGroupList
* @returns schemaGroupList
*/
getSchemaByGroup(): import("vue").Ref<{
list: {
[x: string]: any;
type: string;
label?: string | undefined;
field?: string | undefined;
name?: string | undefined;
slotName?: string | undefined;
componentProps?: any;
id?: string | undefined;
rules?: {
[x: string]: any;
trigger?: string | string[] | undefined;
required?: boolean | undefined;
type?: string | undefined;
pattern?: string | {
exec: (string: string) => RegExpExecArray | null;
test: (string: string) => boolean;
readonly source: string;
readonly global: boolean;
readonly ignoreCase: boolean;
readonly multiline: boolean;
lastIndex: number;
compile: (pattern: string, flags?: string | undefined) => RegExp;
readonly flags: string;
readonly sticky: boolean;
readonly unicode: boolean;
readonly dotAll: boolean;
readonly hasIndices: boolean;
[Symbol.match]: (string: string) => RegExpMatchArray | null;
[Symbol.replace]: {
(string: string, replaceValue: string): string;
(string: string, replacer: (substring: string, ...args: any[]) => string): string;
};
[Symbol.search]: (string: string) => number;
[Symbol.split]: (string: string, limit?: number | undefined) => string[];
[Symbol.matchAll]: (str: string) => IterableIterator<RegExpMatchArray>;
} | undefined;
min?: number | undefined;
max?: number | undefined;
len?: number | undefined;
enum?: (string | number | boolean | null | undefined)[] | undefined;
whitespace?: boolean | undefined;
validator?: string | undefined;
isValidator?: boolean | undefined;
message?: string | ((a?: string | undefined) => string) | undefined;
}[] | undefined;
noFormItem?: boolean | undefined;
input?: boolean | undefined;
immovable?: boolean | undefined;
childImmovable?: boolean | undefined;
labelCol?: any;
wrapperCol?: any;
children?: any[] | undefined;
slots?: {
[slotName: string]: NodeItem[];
} | undefined;
show?: boolean | ((renderCallbackParams: import('../../core/types/epic-designer').RenderCallbackParams) => boolean) | undefined;
editData?: any;
}[];
title: string;
}[]>;
/**
* 添加公共方法
* @param method
*/
addPublicMethod(method: MethodModel): void;
}
export declare const pluginManager: PluginManager;