///
import * as EventAPI from 'events';
import CanvasView from './canvas-view';
import GraphView, { IGraph, ILayout } from './graph-view';
import NodeView, { INode } from './node-view';
import EdgeView, { IEdge } from './edge-view';
import SlotView, { ISlot } from './slot-view';
import { GenericConstructor } from './util';
import './static/index.less';
export interface InitialSettings {
/** 挂载 geditor 的 dom 节点 */
dom: Element;
/** 图数据结构 */
graph?: IGraph;
/** 图布局信息 */
layout?: ILayout;
/** 图是否可编辑 */
editable?: boolean;
/**
* methods 是提供给 geditor 的二次开发者和其面向的上层业务之间通信的方式
* 比如:
* dag-editor 的算子被点击以后需要展示代表运行结果的圆圈组,
* 圆圈组的颜色取决于算子的运行结果是否存在。
* dag-editor 可以在 methods 中定义名为 `isOutputExists` 的方法,
* dag-editor 的使用者必须实现该方法,以便 dag-editor 可以调用该方法来获知输出是否存在,
* 从而决定如何绘制圆圈组。
*/
methods?: {
[key: string]: any;
};
}
export default class GEditor extends EventAPI {
private layout;
canvasView: CanvasView;
graphView: GraphView;
methods: InitialSettings['methods'];
constructor(settings: InitialSettings);
private validateLayout(graph, layout);
protected autoLayout(graph: IGraph): ILayout;
destroy(): void;
isActive(): boolean;
/**
* nodeView 工厂方法
*/
getNodeViewClass(nodeConfig: INode): GenericConstructor;
/**
* edgeView 工厂方法
*/
getEdgeViewClass(edgeConfig: IEdge): GenericConstructor;
/**
* slotView 工厂方法
*/
getSlotViewClass(slotConfig: ISlot): GenericConstructor;
/**
* slot 是否可连接,默认全部可连
* 不同的 editor 请根据各自的业务逻辑实现该方法
*/
connectable(srcSlot: SlotView, destSlot: SlotView, graphView: GraphView): boolean;
initPlugin(): void;
static getInstanceByDom(dom: Element | string): (GEditor | null);
static draggable(dom: Element, nodeConfig: INode): void;
static destroy(dom: Element | string): void;
}