@logicflow/core 1.0.6 → 1.1.0-alpha.0

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.6",
3
+ "version": "1.1.0-alpha.0",
4
4
  "description": "LogicFlow core, to quickly build flowchart editor",
5
5
  "main": "dist/logic-flow.js",
6
6
  "unpkg": "dist/logic-flow.js",
@@ -42,7 +42,19 @@ export default class LogicFlow {
42
42
  options: Options.Definition;
43
43
  snaplineModel: SnaplineModel;
44
44
  components: ComponentRender[];
45
+ /**
46
+ * 个性配置的插件,覆盖全局配置的插件
47
+ */
48
+ plugins: Extension[];
49
+ /**
50
+ * 全局配置的插件,所有的LogicFlow示例都会使用
51
+ */
45
52
  static extensions: Map<string, Extension>;
53
+ /**
54
+ * 插件扩展方法
55
+ * @example
56
+ */
57
+ extension: Record<string, any>;
46
58
  /**
47
59
  * 自定义数据格式转换方法
48
60
  * 当接入系统格式和logicflow格式不一直的时候,可以自定义此方法来转换数据格式
@@ -195,7 +207,7 @@ export default class LogicFlow {
195
207
  * })
196
208
  * @param {object} edgeConfig
197
209
  */
198
- addEdge(edgeConfig: EdgeConfig): void;
210
+ addEdge(edgeConfig: EdgeConfig): _Model.BaseEdgeModel;
199
211
  /**
200
212
  * 删除边
201
213
  * @param {string} edgeId 边Id
@@ -430,9 +442,7 @@ export default class LogicFlow {
430
442
  static use(extension: Extension): void;
431
443
  private installPlugins;
432
444
  /**
433
- * 加载插件
434
- * 注意,不建议插件用这种方式加载,此方式只会出发render方法,
435
- * 可能不会实时出发cont
445
+ * 加载插件-内部方法
436
446
  */
437
447
  private installPlugin;
438
448
  /**
@@ -284,7 +284,7 @@ declare class GraphModel {
284
284
  * 给两个节点之间添加一条边
285
285
  * @param {object} edgeConfig
286
286
  */
287
- addEdge(edgeConfig: EdgeConfig): EdgeConfig;
287
+ addEdge(edgeConfig: EdgeConfig): BaseEdgeModel;
288
288
  /**
289
289
  * 移动边,内部方法,请勿直接使用
290
290
  */
@@ -1,6 +1,6 @@
1
1
  import { GridOptions } from './view/overlay/Grid';
2
2
  import { BackgroundConfig } from './view/overlay/BackgroundOverlay';
3
- import { NodeData, EdgeData, GraphConfigData } from './type';
3
+ import { NodeData, EdgeData, Extension, GraphConfigData } from './type';
4
4
  import { KeyboardDef } from './keyboard';
5
5
  import { EditConfigInterface } from './model/EditConfigModel';
6
6
  import { Theme } from './constant/DefaultTheme';
@@ -85,6 +85,10 @@ export declare type Definition = {
85
85
  * todo: 将multipleSelect放到插件中
86
86
  */
87
87
  disabledTools?: string[];
88
+ /**
89
+ * 是否配置个性插件,覆盖全局配置的插件
90
+ */
91
+ plugins?: Extension[];
88
92
  [key: string]: any;
89
93
  } & EditConfigInterface;
90
94
  export interface GuardsTypes {
@@ -169,6 +173,10 @@ export declare function get(options: Definition): {
169
173
  * todo: 将multipleSelect放到插件中
170
174
  */
171
175
  disabledTools?: string[];
176
+ /**
177
+ * 是否配置个性插件,覆盖全局配置的插件
178
+ */
179
+ plugins?: Extension[];
172
180
  } & EditConfigInterface;
173
181
  export declare const defaults: {
174
182
  background: boolean;
@@ -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;
@@ -56,7 +56,7 @@ export declare const isSegmentsInNode: (start: Point, end: Point, node: BaseNode
56
56
  export declare const isSegmentsCrossNode: (start: Point, end: Point, node: BaseNode) => boolean;
57
57
  export declare const getCrossPointInRect: (start: Point, end: Point, node: BaseNode) => Point;
58
58
  export declare const segmentDirection: (start: Point, end: Point) => Direction;
59
- export declare const poins2PointsList: (points: string) => PolyPoint[];
59
+ export declare const points2PointsList: (points: string) => PolyPoint[];
60
60
  export declare const getSimplePoints: (start: any, end: any, sPoint: any, tPoint: any) => Point[];
61
61
  export declare const getBytesLength: (word: string) => number;
62
62
  export declare const getTextWidth: (text: any, font: any) => any;
@@ -67,7 +67,7 @@ declare type AppendAttributesType = {
67
67
  strokeWidth: number;
68
68
  strokeDasharray: string;
69
69
  };
70
- export declare const getAppendAttibutes: (appendInfo: any) => AppendAttributesType;
70
+ export declare const getAppendAttributes: (appendInfo: any) => AppendAttributesType;
71
71
  export declare type IBezierControls = {
72
72
  sNext: Point;
73
73
  ePre: Point;
@@ -15,7 +15,7 @@ declare type IProps = {
15
15
  style: ArrowStyle;
16
16
  };
17
17
  export default class Arrow extends Component<IProps> {
18
- getArrowAttibutes(): ArrowAttributesType;
18
+ getArrowAttributes(): ArrowAttributesType;
19
19
  getShape(): h.JSX.Element;
20
20
  render(): h.JSX.Element;
21
21
  }
@@ -25,7 +25,7 @@ export default class PolylineEdge extends BaseEdge {
25
25
  getEdge(): h.JSX.Element;
26
26
  getShape(): h.JSX.Element;
27
27
  getArrowInfo(): ArrowInfo;
28
- getAppendAttibutes(appendInfo: AppendInfo): AppendAttributesType;
28
+ getAppendAttributes(appendInfo: AppendInfo): AppendAttributesType;
29
29
  getAppendShape(appendInfo: AppendInfo): h.JSX.Element;
30
30
  getAppendWidth(): h.JSX.Element;
31
31
  }