@logicflow/core 1.0.7 → 1.1.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logicflow/core",
3
- "version": "1.0.7",
3
+ "version": "1.1.0-alpha.3",
4
4
  "description": "LogicFlow core, to quickly build flowchart editor",
5
5
  "main": "dist/logic-flow.js",
6
6
  "unpkg": "dist/logic-flow.js",
@@ -47,9 +47,14 @@ export default class LogicFlow {
47
47
  */
48
48
  plugins: Extension[];
49
49
  /**
50
- * 全局配置的插件,所有的LogicFlow都会使用
50
+ * 全局配置的插件,所有的LogicFlow示例都会使用
51
51
  */
52
52
  static extensions: Map<string, Extension>;
53
+ /**
54
+ * 插件扩展方法
55
+ * @example
56
+ */
57
+ extension: Record<string, any>;
53
58
  /**
54
59
  * 自定义数据格式转换方法
55
60
  * 当接入系统格式和logicflow格式不一直的时候,可以自定义此方法来转换数据格式
@@ -142,6 +147,16 @@ export default class LogicFlow {
142
147
  * @param id 元素id
143
148
  */
144
149
  deleteElement(id: any): boolean;
150
+ /**
151
+ * 获取节点或边对象
152
+ * @param id id
153
+ */
154
+ getModelById(id: string): _Model.BaseNodeModel | _Model.BaseEdgeModel;
155
+ /**
156
+ * 获取节点或边的数据
157
+ * @param id id
158
+ */
159
+ getDataById(id: string): NodeConfig | EdgeConfig;
145
160
  /**
146
161
  * 修改指定节点类型
147
162
  * @param id 节点id
@@ -437,9 +452,7 @@ export default class LogicFlow {
437
452
  static use(extension: Extension): void;
438
453
  private installPlugins;
439
454
  /**
440
- * 加载插件
441
- * 注意,不建议插件用这种方式加载,此方式只会出发render方法,
442
- * 可能不会实时出发cont
455
+ * 加载插件-内部方法
443
456
  */
444
457
  private installPlugin;
445
458
  /**
@@ -74,7 +74,8 @@ export declare enum EventType {
74
74
  CONNECTION_NOT_ALLOWED = "connection:not-allowed",
75
75
  HISTORY_CHANGE = "history:change",
76
76
  TEXT_UPDATE = "text:update",
77
- GRAPH_TRANSFORM = "graph:transform"
77
+ GRAPH_TRANSFORM = "graph:transform",
78
+ GRAPH_RENDERED = "graph:rendered"
78
79
  }
79
80
  export declare enum SegmentDirection {
80
81
  HORIZONTAL = "horizontal",
@@ -2,7 +2,6 @@ import BaseNodeModel from './node/BaseNodeModel';
2
2
  import BaseEdgeModel from './edge/BaseEdgeModel';
3
3
  import EditConfigModel from './EditConfigModel';
4
4
  import TransfromModel from './TransformModel';
5
- import { IBaseModel } from './BaseModel';
6
5
  import { OverlapMode } from '../constant/constant';
7
6
  import { AdditionData, Point, NodeConfig, EdgeConfig, PointTuple, NodeMoveRule, GraphConfigData } from '../type';
8
7
  import EventEmitter from '../event/eventEmitter';
@@ -115,6 +114,9 @@ declare class GraphModel {
115
114
  model: BaseEdgeModel;
116
115
  };
117
116
  };
117
+ get modelsMap(): {
118
+ [key: string]: BaseNodeModel | BaseEdgeModel;
119
+ };
118
120
  /**
119
121
  * 基于zIndex对元素进行排序。
120
122
  * todo: 性能优化
@@ -183,7 +185,7 @@ declare class GraphModel {
183
185
  /**
184
186
  * 获取节点或者边的model
185
187
  */
186
- getElement(id: string): IBaseModel | undefined;
188
+ getElement(id: string): BaseNodeModel | BaseEdgeModel | undefined;
187
189
  /**
188
190
  * 所有节点上所有边的model
189
191
  */
@@ -287,6 +287,7 @@ export interface LogicFlowContractor {
287
287
  new (option: Options.Definition): LogicFlow;
288
288
  }
289
289
  export interface ExtensionContractor {
290
+ pluginName: string;
290
291
  new ({ lf: LogicFlow, LogicFlow: LogicFlowContractor, }: {
291
292
  lf: any;
292
293
  LogicFlow: any;