xuhongxu96 / editflow

DAG workflow editor
4 stars 0 forks source link

Customizable #5

Open xuhongxu96 opened 4 years ago

xuhongxu96 commented 4 years ago

What "Customizable" means?

Users can do easy customization by modifying a config. Users can do deep customization by replace them with their own components.

We want to support both scenarios.

Customizable Parts

xuhongxu96 commented 3 years ago

Component Style Customization

Node Customization

export interface Node<T> {
  layout: IRect;

  title: string;

  input: Port[];
  output: Port[];

  // For customization
  type: string;
  data: T;
}

export interface NodeConfig {
  styles: {
    [type: string]: {
      component: React.Component;
      config: any;
    };
  };
}

DraftEdge Customization

export interface DraftEdgeConfig {
  typeMapFn: (startPort: IPortMeta) => string;
  styles: {
    [type: string]: {
      component: React.Component;
      config: any;
    };
  };
}

Edge Customization

export interface Edge<T> {
  start: NodePort;
  end: NodePort;

  type: string;
  data: T;
}

export interface EdgeConfig {
  styles: {
    [type: string]: {
      component: React.Component;
      config: any;
    };
  };
}

Event Handling Customization

TBD