@chamn/engine
Version:
46 lines (45 loc) • 2.46 kB
TypeScript
import { CPluginCtx } from '../../../../core/pluginManager';
import { Layout, LayoutDragAndDropExtraDataType, LayoutDragEvent } from '../../../../index';
import { AdvanceCustom, CNode, CRootNode } from '@chamn/model';
export interface AdvanceCustomHookOptions {
getPortalViewCtx: () => {
setView: (view: React.ReactNode) => void;
clearView: () => void;
};
ctx: CPluginCtx;
layoutRef: React.RefObject<Layout>;
}
export type HookParameter = {
dragNode?: CNode | CRootNode;
dropNode?: CNode | CRootNode;
eventObj: LayoutDragEvent<LayoutDragAndDropExtraDataType>;
};
export declare class AdvanceCustomHook {
getPortalViewCtx: AdvanceCustomHookOptions['getPortalViewCtx'];
ctx: CPluginCtx;
layoutRef: AdvanceCustomHookOptions['layoutRef'];
constructor(options: AdvanceCustomHookOptions);
canDrag({ dragNode, eventObj }: HookParameter): ReturnType<Required<AdvanceCustom>['canDragNode']>;
canDrop({ dragNode, dropNode, eventObj }: HookParameter): ReturnType<Required<AdvanceCustom>['canDropNode']>;
onNewAdd({ dragNode, dropNode, eventObj }: HookParameter): ReturnType<Required<AdvanceCustom>['onNewAdd']>;
getSelectRectViewRender(node: CNode | CRootNode): ((props: import('@chamn/model').CustomViewRenderProps) => React.ReactElement) | undefined;
getHoverRectViewRender(node?: CNode | CRootNode | null): ((props: import('@chamn/model').CustomViewRenderProps) => React.ReactElement) | null | undefined;
getDropViewRender(node?: CNode | CRootNode | null): ((props: import('@chamn/model').CustomViewRenderProps & {
canDrop: boolean;
posInfo: import('@chamn/model').DropPosType;
}) => React.ReactElement) | null | undefined;
getGhostViewRender(node?: CNode | CRootNode | null): ((props: import('@chamn/model').CustomViewRenderProps) => React.ReactElement) | null | undefined;
getToolbarViewRender(node?: CNode | CRootNode | null): ((props: {
node: CNode | CRootNode;
context: any;
toolBarItems: {
copyItem: React.ReactElement;
deleteItem: React.ReactElement;
visibleItem: React.ReactElement;
nodeLayout: React.ReactElement;
};
toolBarItemList: React.ReactElement[];
}) => React.ReactElement) | null | undefined;
onCopy(node: CNode | CRootNode): Promise<false | CNode | CRootNode>;
onDelete(node: CNode | CRootNode): Promise<false | CNode | CRootNode>;
}