import type { CopyNodeRepacerType, DSLNodeType } from '@lingxiteam/dsl'; import type { DSLQuery } from '@lingxiteam/dsl/lib/core/DSLQuery'; import { DropPosition } from '../PageZone/types'; export interface AddComponentType { compName: string; busiCompName: string; label: string; busiCompId: string; id: string; path: string[]; inContainer?: boolean; dropIndex?: number; dragItem: any; } /** * node节点操作 * @returns */ declare const useNodeAction: (DSLCore?: DSLQuery) => { /** * 将拖拽节点放置到目标容器内 * @param param0 */ addComponent({ targetId, dragId, }: { dragId: string; targetId: string; dropIndex?: number | undefined; }): void; updateComponent(comp: any): void; /** * 增加组件到表单容器内 */ addComponentToFormContainer: ({ compName, busiCompName, busiCompId, label, formContainerId, formItemIndex, dragCompId, dragItem, containerId, }: { compName?: string | undefined; busiCompName?: string | undefined; busiCompId?: string | undefined; label?: string | undefined; formContainerId: string; formItemIndex?: number | undefined; dragCompId?: string | undefined; dragItem: any; containerId: string; }, replacer?: ((comp: any) => any) | undefined) => void; /** * 增加组件 * @param comp */ addSingleCompByCreator({ compName, busiCompName, busiCompId, label, id, dropIndex, inContainer, dragItem, }: AddComponentType, replacer?: ((comp: any) => any) | undefined): void; /** * 移动组件 */ moveComponent: (dragComp: any, hoverComp: any, position: DropPosition) => void; /** * 复制 * @param id 组件id 必填 * @param showMsg 是否展示弹出框 默认展示 */ copyComponent(id: string, showMsg?: boolean): void; /** * 粘贴到某个组件下 * @param node 组件节点 * @param pasteReplacer 替换构造器 */ pasteComponentTo(curNode: DSLNodeType | null | undefined, pasteReplacer?: ((e: CopyNodeRepacerType) => CopyNodeRepacerType) | undefined): void; /** * 移除节点 * @param node 删除 */ removeComponent(node: DSLNodeType | string, editPageZoneCanRemoveCompBefore?: ((node: DSLNodeType) => boolean) | undefined): void; /** * * @param node 移动节点或节点id * @param direction 前移 forward 后移 backend */ moveComponentForwardOrBackend(node: DSLNodeType | string, direction?: 'forward' | 'backend'): void; }; export default useNodeAction;