@chamn/engine
Version:
61 lines (60 loc) • 2.78 kB
TypeScript
import { default as React } from 'react';
import { Layout, LayoutPropsType } from '@chamn/layout';
import { AdvanceCustom, CNode, CPage, CRootNode, AdvanceCustomFuncParam } from '@chamn/model';
import { CPluginCtx } from '../../../../core/pluginManager';
import { AdvanceCustomHook } from './advanceCustomHook';
import { DesignerPluginConfig } from '../../type';
export type DesignerCtx = CPluginCtx<DesignerPluginConfig>;
export type DesignerPropsType = {
pluginCtx: DesignerCtx;
};
export type WrapComponentOptionsType = {
ctx: DesignerCtx;
node: CNode | CRootNode;
};
type DesignerStateType = {
pageModel: CPage;
hoverToolbarView: React.ReactNode;
selectToolbarView: React.ReactNode;
selectRectViewRender: AdvanceCustom['selectRectViewRender'] | null;
hoverRectViewRender: AdvanceCustom['hoverRectViewRender'] | null;
dropViewRender: AdvanceCustom['dropViewRender'] | null;
ghostView: React.ReactNode;
portalView: React.ReactNode;
};
export declare class Designer extends React.Component<DesignerPropsType, DesignerStateType> {
layoutRef: React.RefObject<Layout>;
customAdvanceHook: AdvanceCustomHook;
constructor(props: DesignerPropsType);
getPortalViewCtx: () => {
setView: (view: React.ReactNode) => void;
clearView: () => void;
};
/**
* 更新 render 中的 components ;
*/
updateRenderComponents(newComponentMap?: Record<string, any>): Promise<void>;
componentDidMount(): void;
getIframeDom(): import('@chamn/layout').IFrameContainer | undefined;
reloadRender(): void;
init(): Promise<void>;
onNodeDragging: LayoutPropsType['onNodeDragging'];
onNodeDragEnd: LayoutPropsType['onNodeDraEnd'];
onNodeDrop: LayoutPropsType['onNodeDrop'];
onSelectNode: Required<LayoutPropsType>['onSelectNode'];
onDragStart: LayoutPropsType['onNodeDragStart'];
getGhostView: (dragNode: CNode | CRootNode, commonParam: AdvanceCustomFuncParam) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
toSelectNode: (nodeId: string) => Promise<boolean>;
toCopyNode: (id: string) => Promise<true | undefined>;
toDeleteNode: (nodeId: string) => Promise<boolean | undefined>;
toHidden: (id: string) => true | undefined;
getToolbarView: (node: CNode | CRootNode) => import("react/jsx-runtime").JSX.Element;
onHoverNode: LayoutPropsType['onHoverNode'];
nodeCanDrag: LayoutPropsType['nodeCanDrag'];
nodeCanDrop: LayoutPropsType['nodeCanDrop'];
innerSelectRectViewRender: LayoutPropsType['selectRectViewRender'];
innerHoverRectViewRender: LayoutPropsType['hoverRectViewRender'];
innerDropViewRender: LayoutPropsType['dropViewRender'];
render(): import("react/jsx-runtime").JSX.Element;
}
export {};