import { default as React, ReactInstance } from 'react'; import { ComplexSetterTypeEnum, DropPosType, LibMetaType, SetterBasicType, SetterTypeEnum } from './base'; import { CNodeDataType } from './node'; import { CNode } from '../Page/RootNode/Node'; import { CRootNode } from '../Page/RootNode'; export declare enum BaseDataType { STRING = "string", NUMBER = "number", BOOLEAN = "boolean", OBJECT = "object", ARRAY = "array" } export declare enum AdvanceDataType { SHAPE = "shape", ENUMS = "enums", UNION = "union" } export declare enum SpecialDataType { COMPONENT = "component", EXPRESSION = "expression", FUNCTION = "function" } export type MTitle = string | { label: string; tip?: string; }; export declare const getMTitle: (title: MTitle) => any; export declare const getMTitleTip: (title: MTitle) => any; export declare const MTitleDescribe: import('superstruct').Struct; export type ShapeDataType = { type: AdvanceDataType.SHAPE | `${AdvanceDataType.SHAPE}`; value: { name: string; title: MTitle; valueType: PropsValueType; }[]; }; export declare const ShapeDataTypeDescribe: import('superstruct').Struct<{ type: AdvanceDataType.SHAPE; value: { name: string; title: string | { label: string; tip?: string | undefined; }; valueType?: any; }[]; }, { type: import('superstruct').Struct; value: import('superstruct').Struct<{ name: string; title: string | { label: string; tip?: string | undefined; }; valueType?: any; }[], import('superstruct').Struct<{ name: string; title: string | { label: string; tip?: string | undefined; }; valueType?: any; }, { name: import('superstruct').Struct; title: import('superstruct').Struct; valueType: import('superstruct').Struct; }>>; }>; export type EnumDataType = { type: AdvanceDataType.ENUMS | `${AdvanceDataType.ENUMS}`; value: string[]; }; export declare const EnumDataTypeDescribe: import('superstruct').Struct<{ type: AdvanceDataType.ENUMS; value: string[]; }, { type: import('superstruct').Struct; value: import('superstruct').Struct>; }>; export type ArrayDataType = { type: BaseDataType.ARRAY | `${BaseDataType.ARRAY}`; value: PropsValueType; }; export declare const ArrayDataTypeDescribe: import('superstruct').Struct<{ type: BaseDataType.ARRAY; value?: any; }, { type: import('superstruct').Struct; value: import('superstruct').Struct; }>; export type UnionDataType = { type: AdvanceDataType.UNION | `${AdvanceDataType.UNION}`; value: PropsValueType[]; }; export declare const UnionDataTypeDescribe: import('superstruct').Struct<{ type: BaseDataType.ARRAY; value: any[]; }, { type: import('superstruct').Struct; value: import('superstruct').Struct; }>; export type PropsValueType = BaseDataType | `${BaseDataType}` | SpecialDataType | `${SpecialDataType}` | ShapeDataType | EnumDataType | ArrayDataType | UnionDataType; export declare const PropsValueTypeDescribe: any; export type SetterType = SetterTypeEnum | `${SetterTypeEnum}` | ComplexSetterTypeEnum | `${ComplexSetterTypeEnum}` | SetterObjType | T | `${T}`; export type BasicSetterObjType = { componentName: SetterTypeEnum | `${SetterTypeEnum}` | T | `${T}`; props?: Record; /** 被设置属性的初始值 */ initialValue?: any; /** props reference CSetterProps from engine */ component?: (props: any) => React.ReactNode; /** 是否隐藏前面的 label */ hiddenLabel?: boolean; labelWidth?: string; labelAlign?: 'start' | 'center' | 'end'; }; export type ShapeSetterObjType = { componentName: ComplexSetterTypeEnum.SHAPE_SETTER | `${ComplexSetterTypeEnum.SHAPE_SETTER}` | T | `${T}`; props?: { elements: MaterialPropType[]; /** 是否可以收缩,默认: true */ collapse?: boolean | { open?: boolean; }; } & {}; initialValue: any; /** props reference CSetterProps from engine */ component?: (props: any) => React.ReactNode; hiddenLabel?: boolean; labelWidth?: string; labelAlign?: 'start' | 'center' | 'end'; }; export type ArraySetterObjType = { componentName: ComplexSetterTypeEnum.ARRAY_SETTER | `${ComplexSetterTypeEnum.ARRAY_SETTER}` | T | `${T}`; props?: { collapse?: boolean | { open?: boolean; }; item: { setters: SetterType[]; initialValue: any; }; itemLabelPrefix?: string; sortLabelKey?: any; }; initialValue: any; /** props reference CSetterProps from engine */ component?: (props: any) => React.ReactNode; hiddenLabel?: boolean; labelWidth?: string; labelAlign?: 'start' | 'center' | 'end'; }; export type SetterObjType = BasicSetterObjType | ShapeSetterObjType | ArraySetterObjType; export declare const SetterTypeDescribe: import('superstruct').Struct; export type MaterialPropType = { name: string; title: MTitle; valueType: PropsValueType; description?: string; defaultValue?: any; setters?: SetterType[]; condition?: (state: any) => boolean; }; export declare const MaterialPropDescribe: import('superstruct').Struct<{ name: string; title: string | { label: string; tip?: string | undefined; }; description?: string | undefined; condition?: Function | undefined; valueType?: any; defaultValue?: any; setters?: (string | { componentName: string; props?: any; component?: any; initialValue?: any; hiddenLabel?: boolean | undefined; })[] | undefined; }, { name: import('superstruct').Struct; title: import('superstruct').Struct; valueType: any; description: import('superstruct').Struct; defaultValue: import('superstruct').Struct; setters: import('superstruct').Struct<(string | { componentName: string; props?: any; component?: any; initialValue?: any; hiddenLabel?: boolean | undefined; })[] | undefined, import('superstruct').Struct>; condition: import('superstruct').Struct; }>; export type ActionType = string | ((node: CNode | CRootNode, context: any) => React.ReactNode); export declare const ActionTypeDescribe: import('superstruct').Struct; export declare enum PropsUIType { SINGLE = "single", GROUP = "group" } export type SpecialMaterialPropType = { title: MTitle; type: PropsUIType.SINGLE | `${PropsUIType.SINGLE}`; content: MaterialPropType; } | { title: MTitle; type: PropsUIType.GROUP | `${PropsUIType.GROUP}`; content: MaterialPropType[]; }; export type CMaterialPropsType = (MaterialPropType | SpecialMaterialPropType)[]; export declare const isSpecialMaterialPropType: (val: any) => val is SpecialMaterialPropType; export type TFunctionOrEventParameter = { /** 参数名 */ name: string; /** 参数的 ts 类型 */ tsType?: string; description?: string; example?: string; }; export type CMaterialEventType = string | { /** 对外展示的描述 */ name?: string; /** 事件 key */ event: string; descriptions?: string; params?: TFunctionOrEventParameter[]; template?: string; }; export declare const CMaterialEventTypeDescribe: import('superstruct').Struct; export type SnippetsType = { id?: string; title: string; snapshotText?: string; snapshot?: string | React.ReactNode; description?: string | React.ReactNode; tags?: string[]; groupName?: string; category?: string; schema: Omit & { componentName?: string; }; }; export type SnippetsStanderType = Omit & { schema: Omit; }; export declare const SnippetsTypeDescribe: import('superstruct').Struct<{ title: string; schema: { [x: string]: any; }; description?: string | undefined; id?: string | undefined; tags?: string[] | undefined; groupName?: string | undefined; category?: string | undefined; snapshotText?: string | undefined; snapshot?: any; }, { id: import('superstruct').Struct; title: import('superstruct').Struct; snapshot: import('superstruct').Struct; snapshotText: import('superstruct').Struct; description: import('superstruct').Struct; tags: import('superstruct').Struct>; groupName: import('superstruct').Struct; category: import('superstruct').Struct; schema: import('superstruct').Struct<{ [x: string]: any; }, { [x: string]: import('superstruct').Struct; componentName: import('superstruct').Struct; }>; }>; export type ContainerConfig = { placeholder: string; width: string; height: string; style?: React.CSSProperties; }; export type DragAndDropEventExtraData = { dropType?: 'NEW_ADD' | 'NORMAL' | ''; dragNode?: CNode | CRootNode; dragNodeUID?: string; dropNode?: CNode | CRootNode; dropNodeUID?: string; dropPosInfo?: DropPosType; }; export type CustomViewRenderProps = { node: CNode | CRootNode; params: AdvanceCustomFuncParam; componentInstance?: ReactInstance; /** 一个组件可能被循环渲染,这里表示是第几个索引 **/ componentInstanceIndex?: number; }; export type AdvanceCustomFuncParam = { dropNode?: CNode | CRootNode; viewPortal: { setView: (view: React.ReactNode) => void; clearView: () => void; }; isLock?: boolean; context: any; cancelDrag?: () => void; /** 如果是 api 触发的,则没有事件对象 */ event?: any; extra: DragAndDropEventExtraData; }; export type EventName = keyof HTMLElementEventMap; export type AdvanceCustom = { canDragNode?: (node: CNode | CRootNode, params: AdvanceCustomFuncParam) => Promise; onDragStart?: (node: CNode | CRootNode, params: AdvanceCustomFuncParam) => Promise; /** 拖动中触发 */ onDragging?: (node: CNode | CRootNode, params: AdvanceCustomFuncParam) => Promise; onDragEnd?: (node: CNode | CRootNode, params: AdvanceCustomFuncParam) => void; /** 当有其他 node 被放置到当前 node 的 child 时触发校验,可以控制落点的 UI 样式? */ canAcceptNode?: (node: CNode | CRootNode, params: AdvanceCustomFuncParam) => Promise; /** 当前节点是否能被放置, 可以控制落点的 UI 样 */ canDropNode?: (node: CNode | CRootNode, params: AdvanceCustomFuncParam) => Promise; onDrop?: (node: CNode | CRootNode, params: AdvanceCustomFuncParam) => Promise; /** 当第一次被拖入到画布时触发 */ onNewAdd?: (node: CNode | CRootNode, params: AdvanceCustomFuncParam) => Promise; /** 当元素被删除时触发 */ onDelete?: (node: CNode | CRootNode, params: AdvanceCustomFuncParam) => Promise; /** 元素被选中时触发 */ onSelect?: (node: CNode | CRootNode, params: AdvanceCustomFuncParam) => Promise | { selectedNode?: CNode | CRootNode; }; onCopy?: (node: CNode | CRootNode, params: AdvanceCustomFuncParam) => Promise; toolbarViewRender?: (props: { node: CNode | CRootNode; context: any; toolBarItems: { copyItem: React.ReactElement; deleteItem: React.ReactElement; visibleItem: React.ReactElement; nodeLayout: React.ReactElement; }; toolBarItemList: React.ReactElement[]; }) => React.ReactElement; selectRectViewRender?: (props: CustomViewRenderProps) => React.ReactElement; hoverRectViewRender?: (props: CustomViewRenderProps) => React.ReactElement; dropViewRender?: (props: CustomViewRenderProps & { canDrop: boolean; posInfo: DropPosType; }) => React.ReactElement; ghostViewRender?: (props: CustomViewRenderProps) => React.ReactElement; wrapComponent?: (targetComponent: (...args: any[]) => React.ReactElement, options: { ctx: any; node: CNode | CRootNode; }) => (...args: any[]) => React.ReactElement; dropPlaceholder?: (props: { node: CNode | CRootNode; }) => React.ReactElement; /** 配置右侧面板 */ rightPanel?: { /** 是否显示相应的面板 */ visual?: boolean; state?: boolean; advance?: boolean; advanceOptions?: { /** 是否展示 loop 选项 */ loop?: boolean; /** 是否展示 render 选项, 如果为 false 会被包裹 div 并设置 display 为 none */ render?: boolean; }; property?: boolean; customTabs?: { /** 唯一标识 */ key: string; name: string | ((params: { node: CNode | CRootNode | null; pluginCtx: any; }) => string); view: (params: { node: CNode | CRootNode | null; pluginCtx: any; }) => React.ReactElement; show?: (options: { node: CNode | CRootNode | null; pluginCtx: any; }) => boolean; }[]; }; /** 是否自动获取 元素 dom, 配置 getDom 使用, 默认 为 true */ autoGetDom?: boolean; }; export type CMaterialType = { componentName: string; title: string; screenshot?: string; icon?: string; /** 组件标签用于搜索 */ tags?: string[]; /** 分 tab 面板 */ groupName?: string; /** 分类 */ category?: string; /** 排序 */ priority?: number; npm?: LibMetaType; snippets: SnippetsType[]; props: CMaterialPropsType; /** 固定的props, 不被 setter 的值覆盖, 只在编辑模式下会生效 */ fixedProps?: Record | ((props: Record) => Record); /** 可以拖入组件 */ isContainer?: boolean | ContainerConfig; /** 选择框的根选择器 */ rootSelector?: string; /** 是否禁止编辑器的 drag 事件,被命中的 dom 不会出发 编辑器的 */ disableEditorDragDom?: { class?: string[]; id?: string[]; } | boolean; /** TODO: 组件支持的可被调用的方法, todo: 没有补充验证 类型 describe */ methods?: { title: string; name: string; params?: TFunctionOrEventParameter[]; tsType?: string; template?: string; }[]; /** 组件可能触发的事件 */ events?: CMaterialEventType[]; /** 定制组件高级编辑行为 */ advanceCustom?: AdvanceCustom; /** 自定义扩展配置 */ extra?: Record; }; export type CMaterialStanderType = Omit & { snippets: SnippetsStanderType[]; }; export declare const CMaterialTypeDescribe: import('superstruct').Struct<{ componentName: string; props: ({ name: string; title: string | { label: string; tip?: string | undefined; }; description?: string | undefined; condition?: Function | undefined; valueType?: any; defaultValue?: any; setters?: (string | { componentName: string; props?: any; component?: any; initialValue?: any; hiddenLabel?: boolean | undefined; })[] | undefined; } | { type: PropsUIType.SINGLE; content: { name: string; title: string | { label: string; tip?: string | undefined; }; description?: string | undefined; condition?: Function | undefined; valueType?: any; defaultValue?: any; setters?: (string | { componentName: string; props?: any; component?: any; initialValue?: any; hiddenLabel?: boolean | undefined; })[] | undefined; }; title?: string | { label: string; tip?: string | undefined; } | undefined; } | { type: PropsUIType.GROUP; content: { name: string; title: string | { label: string; tip?: string | undefined; }; description?: string | undefined; condition?: Function | undefined; valueType?: any; defaultValue?: any; setters?: (string | { componentName: string; props?: any; component?: any; initialValue?: any; hiddenLabel?: boolean | undefined; })[] | undefined; }[]; title?: string | { label: string; tip?: string | undefined; } | undefined; })[]; title: string; snippets: { title: string; schema: { [x: string]: any; }; description?: string | undefined; id?: string | undefined; tags?: string[] | undefined; groupName?: string | undefined; category?: string | undefined; snapshotText?: string | undefined; snapshot?: any; }[]; methods?: any; extra?: Record | undefined; screenshot?: string | undefined; icon?: string | undefined; tags?: string[] | undefined; groupName?: string | undefined; category?: string | undefined; priority?: number | undefined; npm?: { package: string; version: string; name: string; exportName?: string | undefined; destructuring?: boolean | undefined; subName?: string | undefined; main?: string | undefined; cssPaths?: string[] | undefined; } | undefined; fixedProps?: any; isContainer?: boolean | { placeholder: string; width: string; height: string; } | undefined; rootSelector?: string | undefined; disableEditorDragDom?: any; events?: any; advanceCustom?: any; isLayout?: boolean | undefined; }, { componentName: import('superstruct').Struct; title: import('superstruct').Struct; screenshot: import('superstruct').Struct; icon: import('superstruct').Struct; tags: import('superstruct').Struct>; groupName: import('superstruct').Struct; category: import('superstruct').Struct; priority: import('superstruct').Struct; npm: import('superstruct').Struct<{ package: string; version: string; name: string; exportName?: string | undefined; destructuring?: boolean | undefined; subName?: string | undefined; main?: string | undefined; cssPaths?: string[] | undefined; } | undefined, { package: import('superstruct').Struct; version: import('superstruct').Struct; name: import('superstruct').Struct; exportName: import('superstruct').Struct; destructuring: import('superstruct').Struct; subName: import('superstruct').Struct; main: import('superstruct').Struct; cssPaths: import('superstruct').Struct>; }>; snippets: import('superstruct').Struct<{ title: string; schema: { [x: string]: any; }; description?: string | undefined; id?: string | undefined; tags?: string[] | undefined; groupName?: string | undefined; category?: string | undefined; snapshotText?: string | undefined; snapshot?: any; }[], import('superstruct').Struct<{ title: string; schema: { [x: string]: any; }; description?: string | undefined; id?: string | undefined; tags?: string[] | undefined; groupName?: string | undefined; category?: string | undefined; snapshotText?: string | undefined; snapshot?: any; }, { id: import('superstruct').Struct; title: import('superstruct').Struct; snapshot: import('superstruct').Struct; snapshotText: import('superstruct').Struct; description: import('superstruct').Struct; tags: import('superstruct').Struct>; groupName: import('superstruct').Struct; category: import('superstruct').Struct; schema: import('superstruct').Struct<{ [x: string]: any; }, { [x: string]: import('superstruct').Struct; componentName: import('superstruct').Struct; }>; }>>; props: import('superstruct').Struct<({ name: string; title: string | { label: string; tip?: string | undefined; }; description?: string | undefined; condition?: Function | undefined; valueType?: any; defaultValue?: any; setters?: (string | { componentName: string; props?: any; component?: any; initialValue?: any; hiddenLabel?: boolean | undefined; })[] | undefined; } | { type: PropsUIType.SINGLE; content: { name: string; title: string | { label: string; tip?: string | undefined; }; description?: string | undefined; condition?: Function | undefined; valueType?: any; defaultValue?: any; setters?: (string | { componentName: string; props?: any; component?: any; initialValue?: any; hiddenLabel?: boolean | undefined; })[] | undefined; }; title?: string | { label: string; tip?: string | undefined; } | undefined; } | { type: PropsUIType.GROUP; content: { name: string; title: string | { label: string; tip?: string | undefined; }; description?: string | undefined; condition?: Function | undefined; valueType?: any; defaultValue?: any; setters?: (string | { componentName: string; props?: any; component?: any; initialValue?: any; hiddenLabel?: boolean | undefined; })[] | undefined; }[]; title?: string | { label: string; tip?: string | undefined; } | undefined; })[], import('superstruct').Struct<{ name: string; title: string | { label: string; tip?: string | undefined; }; description?: string | undefined; condition?: Function | undefined; valueType?: any; defaultValue?: any; setters?: (string | { componentName: string; props?: any; component?: any; initialValue?: any; hiddenLabel?: boolean | undefined; })[] | undefined; } | { type: PropsUIType.SINGLE; content: { name: string; title: string | { label: string; tip?: string | undefined; }; description?: string | undefined; condition?: Function | undefined; valueType?: any; defaultValue?: any; setters?: (string | { componentName: string; props?: any; component?: any; initialValue?: any; hiddenLabel?: boolean | undefined; })[] | undefined; }; title?: string | { label: string; tip?: string | undefined; } | undefined; } | { type: PropsUIType.GROUP; content: { name: string; title: string | { label: string; tip?: string | undefined; }; description?: string | undefined; condition?: Function | undefined; valueType?: any; defaultValue?: any; setters?: (string | { componentName: string; props?: any; component?: any; initialValue?: any; hiddenLabel?: boolean | undefined; })[] | undefined; }[]; title?: string | { label: string; tip?: string | undefined; } | undefined; }, null>>; events: import('superstruct').Struct; methods: import('superstruct').Struct; fixedProps: import('superstruct').Struct; isContainer: import('superstruct').Struct; disableEditorDragDom: import('superstruct').Struct; isLayout: import('superstruct').Struct; rootSelector: import('superstruct').Struct; advanceCustom: import('superstruct').Struct; extra: import('superstruct').Struct | undefined, null>; }>;