@ant-design/pro-flow
Version:
A React based Flow components
71 lines (70 loc) • 1.85 kB
TypeScript
import { Edge, Node } from 'reactflow';
import { StateCreator } from 'zustand';
import { ActionPayload } from '../../types';
import { FlowEditorStore } from '../actions';
interface InternalClipboardData {
nodes: Node[];
edges: Edge[];
}
export interface PublicGeneralAction {
/**
* 选择单个元素
* @param id - 元素 id
*/
selectElement: (id: string) => void;
/**
* 选择多个元素
* @param ids - 元素 id 数组
* @param expendSelection - 是否扩展选择,默认为 false
*/
selectElements: (ids: string[], expendSelection?: boolean) => void;
/**
* 选择所有元素
*/
selectAll: () => void;
/**
* 取消选择单个元素
* @param id - 元素 id
*/
deselectElement: (id: string) => void;
/**
* 取消选择所有元素
*/
deselectAll: () => void;
/**
* 删除选中的元素
*/
deleteSelection: () => void;
/**
* 撤销操作
*/
undo: () => void;
/**
* 重做操作
*/
redo: () => void;
/**
* 复制选中的元素
* @returns Promise<InternalClipboardData>
*/
copySelection: () => Promise<InternalClipboardData | undefined>;
/**
* 粘贴选中的元素
* @returns Promise<void>
*/
paste: () => Promise<void>;
}
export interface GeneralActionSlice extends PublicGeneralAction {
internalUpdateSelection: (selectedKeys: string[], payload: ActionPayload) => void;
onElementSelectChange: (id: string, selected: boolean) => void;
pasteIntoFlow: (clipboard: InternalClipboardData) => void;
actionList: () => {
undo: number;
redo: number;
};
}
export declare const generalActionSlice: StateCreator<FlowEditorStore, [
['zustand/devtools', never]
], [
], GeneralActionSlice>;
export {};