@flowgram.ai/free-layout-core 0.1.0-alpha.6 → 0.1.0-alpha.8

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.
@@ -1,4 +1,4 @@
1
- export { v as LineColor, w as LineColors, L as LineEventProps, m as LinePosition, k as LineRenderType, u as LineType, z as NodesDragEndEvent, N as NodesDragEvent, y as NodesDragStartEvent, A as NodesDraggingEvent, O as OnDragLineEnd, s as WorkflowContentChangeEvent, r as WorkflowContentChangeType, q as WorkflowJSON, l as WorkflowLineRenderContribution, x as WorkflowLineRenderContributionFactory, e as WorkflowNodeJSON, t as WorkflowNodeMeta, B as onDragLineEndParams } from '../workflow-line-entity-BCAgoA18.mjs';
1
+ export { v as LineColor, w as LineColors, L as LineEventProps, m as LinePosition, k as LineRenderType, u as LineType, z as NodesDragEndEvent, N as NodesDragEvent, y as NodesDragStartEvent, A as NodesDraggingEvent, O as OnDragLineEnd, s as WorkflowContentChangeEvent, r as WorkflowContentChangeType, q as WorkflowJSON, l as WorkflowLineRenderContribution, x as WorkflowLineRenderContributionFactory, e as WorkflowNodeJSON, t as WorkflowNodeMeta, B as onDragLineEndParams } from '../workflow-line-entity-DSMjQU0t.mjs';
2
2
  export { WorkflowEdgeJSON } from './workflow-edge.mjs';
3
3
  export { WorkflowNodeFormMeta, WorkflowNodeRegistry, WorkflowNodeRenderProps } from './workflow-registry.mjs';
4
4
  export { a as WorkflowSubCanvas } from '../workflow-sub-canvas-DOVla1mw.mjs';
@@ -1,4 +1,4 @@
1
- export { v as LineColor, w as LineColors, L as LineEventProps, m as LinePosition, k as LineRenderType, u as LineType, z as NodesDragEndEvent, N as NodesDragEvent, y as NodesDragStartEvent, A as NodesDraggingEvent, O as OnDragLineEnd, s as WorkflowContentChangeEvent, r as WorkflowContentChangeType, q as WorkflowJSON, l as WorkflowLineRenderContribution, x as WorkflowLineRenderContributionFactory, e as WorkflowNodeJSON, t as WorkflowNodeMeta, B as onDragLineEndParams } from '../workflow-line-entity-DIyrK9yz.js';
1
+ export { v as LineColor, w as LineColors, L as LineEventProps, m as LinePosition, k as LineRenderType, u as LineType, z as NodesDragEndEvent, N as NodesDragEvent, y as NodesDragStartEvent, A as NodesDraggingEvent, O as OnDragLineEnd, s as WorkflowContentChangeEvent, r as WorkflowContentChangeType, q as WorkflowJSON, l as WorkflowLineRenderContribution, x as WorkflowLineRenderContributionFactory, e as WorkflowNodeJSON, t as WorkflowNodeMeta, B as onDragLineEndParams } from '../workflow-line-entity-VNz8dyPS.js';
2
2
  export { WorkflowEdgeJSON } from './workflow-edge.js';
3
3
  export { WorkflowNodeFormMeta, WorkflowNodeRegistry, WorkflowNodeRenderProps } from './workflow-registry.js';
4
4
  export { a as WorkflowSubCanvas } from '../workflow-sub-canvas-DOVla1mw.js';
@@ -2,7 +2,7 @@ import 'react';
2
2
  import '@flowgram.ai/utils';
3
3
  import '@flowgram.ai/document';
4
4
  import '@flowgram.ai/core';
5
- export { L as LineEventProps, z as NodesDragEndEvent, N as NodesDragEvent, y as NodesDragStartEvent, A as NodesDraggingEvent, O as OnDragLineEnd, B as onDragLineEndParams } from '../workflow-line-entity-BCAgoA18.mjs';
5
+ export { L as LineEventProps, z as NodesDragEndEvent, N as NodesDragEvent, y as NodesDragStartEvent, A as NodesDraggingEvent, O as OnDragLineEnd, B as onDragLineEndParams } from '../workflow-line-entity-DSMjQU0t.mjs';
6
6
  import '../workflow-sub-canvas-DOVla1mw.mjs';
7
7
  import '@flowgram.ai/form-core';
8
8
  import './workflow-edge.mjs';
@@ -2,7 +2,7 @@ import 'react';
2
2
  import '@flowgram.ai/utils';
3
3
  import '@flowgram.ai/document';
4
4
  import '@flowgram.ai/core';
5
- export { L as LineEventProps, z as NodesDragEndEvent, N as NodesDragEvent, y as NodesDragStartEvent, A as NodesDraggingEvent, O as OnDragLineEnd, B as onDragLineEndParams } from '../workflow-line-entity-DIyrK9yz.js';
5
+ export { L as LineEventProps, z as NodesDragEndEvent, N as NodesDragEvent, y as NodesDragStartEvent, A as NodesDraggingEvent, O as OnDragLineEnd, B as onDragLineEndParams } from '../workflow-line-entity-VNz8dyPS.js';
6
6
  import '../workflow-sub-canvas-DOVla1mw.js';
7
7
  import '@flowgram.ai/form-core';
8
8
  import './workflow-edge.js';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/typings/workflow-drag.ts"],"sourcesContent":["import type React from 'react';\n\nimport { type PositionSchema } from '@flowgram.ai/utils';\nimport { type FlowNodeEntity } from '@flowgram.ai/document';\nimport { PlaygroundDrag, type PlaygroundDragEvent } from '@flowgram.ai/core';\n\nimport { type WorkflowLineEntity, type WorkflowPortEntity } from '../entities';\n\nexport interface LineEventProps {\n type: 'onDrag' | 'onDragEnd';\n onDragNodeId?: string;\n event?: MouseEvent;\n}\n\ninterface INodesDragEvent {\n type: string;\n nodes: FlowNodeEntity[];\n startPositions: PositionSchema[];\n altKey: boolean;\n dragEvent: PlaygroundDragEvent;\n triggerEvent: MouseEvent | React.MouseEvent;\n dragger: PlaygroundDrag;\n}\n\nexport interface NodesDragStartEvent extends INodesDragEvent {\n type: 'onDragStart';\n}\n\nexport interface NodesDragEndEvent extends INodesDragEvent {\n type: 'onDragEnd';\n}\n\nexport interface NodesDraggingEvent extends INodesDragEvent {\n type: 'onDragging';\n positions: PositionSchema[];\n}\n\nexport type NodesDragEvent = NodesDragStartEvent | NodesDraggingEvent | NodesDragEndEvent;\n\nexport type onDragLineEndParams = {\n fromPort: WorkflowPortEntity;\n toPort?: WorkflowPortEntity;\n mousePos: PositionSchema;\n line?: WorkflowLineEntity;\n originLine?: WorkflowLineEntity;\n event: PlaygroundDragEvent;\n};\n\nexport type OnDragLineEnd = (params: onDragLineEndParams) => Promise<void>;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
1
+ {"version":3,"sources":["../../src/typings/workflow-drag.ts"],"sourcesContent":["import type React from 'react';\n\nimport { type PositionSchema } from '@flowgram.ai/utils';\nimport { type FlowNodeEntity } from '@flowgram.ai/document';\nimport { PlaygroundDrag, type PlaygroundDragEvent } from '@flowgram.ai/core';\n\nimport { type WorkflowLineEntity, type WorkflowPortEntity } from '../entities';\n\nexport interface LineEventProps {\n type: 'onDrag' | 'onDragEnd';\n onDragNodeId?: string;\n event?: MouseEvent;\n}\n\ninterface INodesDragEvent {\n type: string;\n nodes: FlowNodeEntity[];\n startPositions: PositionSchema[];\n dragEvent: PlaygroundDragEvent;\n triggerEvent: MouseEvent | React.MouseEvent;\n dragger: PlaygroundDrag;\n}\n\nexport interface NodesDragStartEvent extends INodesDragEvent {\n type: 'onDragStart';\n}\n\nexport interface NodesDragEndEvent extends INodesDragEvent {\n type: 'onDragEnd';\n}\n\nexport interface NodesDraggingEvent extends INodesDragEvent {\n type: 'onDragging';\n positions: PositionSchema[];\n}\n\nexport type NodesDragEvent = NodesDragStartEvent | NodesDraggingEvent | NodesDragEndEvent;\n\nexport type onDragLineEndParams = {\n fromPort: WorkflowPortEntity;\n toPort?: WorkflowPortEntity;\n mousePos: PositionSchema;\n line?: WorkflowLineEntity;\n originLine?: WorkflowLineEntity;\n event: PlaygroundDragEvent;\n};\n\nexport type OnDragLineEnd = (params: onDragLineEndParams) => Promise<void>;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -1,5 +1,5 @@
1
1
  import '../workflow-sub-canvas-DOVla1mw.mjs';
2
- export { s as WorkflowContentChangeEvent, r as WorkflowContentChangeType, q as WorkflowJSON } from '../workflow-line-entity-BCAgoA18.mjs';
2
+ export { s as WorkflowContentChangeEvent, r as WorkflowContentChangeType, q as WorkflowJSON } from '../workflow-line-entity-DSMjQU0t.mjs';
3
3
  import './workflow-edge.mjs';
4
4
  import '@flowgram.ai/document';
5
5
  import '@flowgram.ai/utils';
@@ -1,5 +1,5 @@
1
1
  import '../workflow-sub-canvas-DOVla1mw.js';
2
- export { s as WorkflowContentChangeEvent, r as WorkflowContentChangeType, q as WorkflowJSON } from '../workflow-line-entity-DIyrK9yz.js';
2
+ export { s as WorkflowContentChangeEvent, r as WorkflowContentChangeType, q as WorkflowJSON } from '../workflow-line-entity-VNz8dyPS.js';
3
3
  import './workflow-edge.js';
4
4
  import '@flowgram.ai/document';
5
5
  import '@flowgram.ai/utils';
@@ -1,5 +1,5 @@
1
1
  import '@flowgram.ai/utils';
2
- export { v as LineColor, w as LineColors, m as LinePosition, k as LineRenderType, u as LineType, l as WorkflowLineRenderContribution, x as WorkflowLineRenderContributionFactory } from '../workflow-line-entity-BCAgoA18.mjs';
2
+ export { v as LineColor, w as LineColors, m as LinePosition, k as LineRenderType, u as LineType, l as WorkflowLineRenderContribution, x as WorkflowLineRenderContributionFactory } from '../workflow-line-entity-DSMjQU0t.mjs';
3
3
  import '@flowgram.ai/core';
4
4
  import '@flowgram.ai/document';
5
5
  import '../workflow-sub-canvas-DOVla1mw.mjs';
@@ -1,5 +1,5 @@
1
1
  import '@flowgram.ai/utils';
2
- export { v as LineColor, w as LineColors, m as LinePosition, k as LineRenderType, u as LineType, l as WorkflowLineRenderContribution, x as WorkflowLineRenderContributionFactory } from '../workflow-line-entity-DIyrK9yz.js';
2
+ export { v as LineColor, w as LineColors, m as LinePosition, k as LineRenderType, u as LineType, l as WorkflowLineRenderContribution, x as WorkflowLineRenderContributionFactory } from '../workflow-line-entity-VNz8dyPS.js';
3
3
  import '@flowgram.ai/core';
4
4
  import '@flowgram.ai/document';
5
5
  import '../workflow-sub-canvas-DOVla1mw.js';
@@ -1,7 +1,7 @@
1
1
  import '@flowgram.ai/utils';
2
2
  import '@flowgram.ai/document';
3
3
  import '../workflow-sub-canvas-DOVla1mw.mjs';
4
- export { e as WorkflowNodeJSON, t as WorkflowNodeMeta } from '../workflow-line-entity-BCAgoA18.mjs';
4
+ export { e as WorkflowNodeJSON, t as WorkflowNodeMeta } from '../workflow-line-entity-DSMjQU0t.mjs';
5
5
  import './workflow-edge.mjs';
6
6
  import '@flowgram.ai/core';
7
7
  import '@flowgram.ai/form-core';
@@ -1,7 +1,7 @@
1
1
  import '@flowgram.ai/utils';
2
2
  import '@flowgram.ai/document';
3
3
  import '../workflow-sub-canvas-DOVla1mw.js';
4
- export { e as WorkflowNodeJSON, t as WorkflowNodeMeta } from '../workflow-line-entity-DIyrK9yz.js';
4
+ export { e as WorkflowNodeJSON, t as WorkflowNodeMeta } from '../workflow-line-entity-VNz8dyPS.js';
5
5
  import './workflow-edge.js';
6
6
  import '@flowgram.ai/core';
7
7
  import '@flowgram.ai/form-core';
@@ -2,7 +2,7 @@ import { FormMeta } from '@flowgram.ai/node';
2
2
  import { FormMetaOrFormMetaGenerator } from '@flowgram.ai/form-core';
3
3
  import { FlowNodeRegistry } from '@flowgram.ai/document';
4
4
  import { W as WorkflowNodeEntity } from '../workflow-sub-canvas-DOVla1mw.mjs';
5
- import { t as WorkflowNodeMeta } from '../workflow-line-entity-BCAgoA18.mjs';
5
+ import { t as WorkflowNodeMeta } from '../workflow-line-entity-DSMjQU0t.mjs';
6
6
  import '@flowgram.ai/utils';
7
7
  import '@flowgram.ai/core';
8
8
  import './workflow-edge.mjs';
@@ -2,7 +2,7 @@ import { FormMeta } from '@flowgram.ai/node';
2
2
  import { FormMetaOrFormMetaGenerator } from '@flowgram.ai/form-core';
3
3
  import { FlowNodeRegistry } from '@flowgram.ai/document';
4
4
  import { W as WorkflowNodeEntity } from '../workflow-sub-canvas-DOVla1mw.js';
5
- import { t as WorkflowNodeMeta } from '../workflow-line-entity-DIyrK9yz.js';
5
+ import { t as WorkflowNodeMeta } from '../workflow-line-entity-VNz8dyPS.js';
6
6
  import '@flowgram.ai/utils';
7
7
  import '@flowgram.ai/core';
8
8
  import './workflow-edge.js';
@@ -1,7 +1,7 @@
1
1
  import * as _flowgram_ai_utils from '@flowgram.ai/utils';
2
- import { IPoint, Rectangle, PositionSchema, Emitter, Event, DisposableCollection } from '@flowgram.ai/utils';
2
+ import { IPoint, Rectangle, PositionSchema, Emitter, Event, PaddingSchema, SizeSchema, ScrollSchema, DisposableCollection } from '@flowgram.ai/utils';
3
3
  import { PlaygroundDragEvent, PlaygroundDrag, EntityManager, SelectionService, Playground, Entity, PlaygroundConfigEntity, PlaygroundContext, EntityOpts } from '@flowgram.ai/core';
4
- import { FlowNodeMeta, FlowNodeJSON, FlowNodeEntity, FlowDocumentOptions, FlowDocument } from '@flowgram.ai/document';
4
+ import { FlowNodeMeta, FlowNodeJSON, FlowNodeEntity, FlowDocumentOptions, FlowLayout, FlowDocumentProvider, FlowDocument } from '@flowgram.ai/document';
5
5
  import { W as WorkflowNodeEntity, a as WorkflowSubCanvas } from './workflow-sub-canvas-DOVla1mw.mjs';
6
6
  import { NodeEngineContext } from '@flowgram.ai/form-core';
7
7
  import { WorkflowEdgeJSON } from './typings/workflow-edge.mjs';
@@ -136,7 +136,6 @@ interface INodesDragEvent {
136
136
  type: string;
137
137
  nodes: FlowNodeEntity[];
138
138
  startPositions: PositionSchema[];
139
- altKey: boolean;
140
139
  dragEvent: PlaygroundDragEvent;
141
140
  triggerEvent: MouseEvent | React.MouseEvent;
142
141
  dragger: PlaygroundDrag;
@@ -214,7 +213,9 @@ declare const WorkflowDocumentOptionsDefault: WorkflowDocumentOptions;
214
213
  /**
215
214
  * 可 Hover 的节点 类型
216
215
  */
217
- type WorkfloEntityHoverable = WorkflowNodeEntity | WorkflowLineEntity | WorkflowPortEntity;
216
+ type WorkflowEntityHoverable = WorkflowNodeEntity | WorkflowLineEntity | WorkflowPortEntity;
217
+ /** @deprecated */
218
+ type WorkfloEntityHoverable = WorkflowEntityHoverable;
218
219
  /**
219
220
  * hover 状态管理
220
221
  */
@@ -283,6 +284,50 @@ declare class WorkflowSelectService {
283
284
  selectNodeAndFocus(node: WorkflowNodeEntity): void;
284
285
  }
285
286
 
287
+ /**
288
+ * 自由画布布局
289
+ */
290
+ declare class FreeLayout implements FlowLayout {
291
+ name: string;
292
+ playgroundConfig: PlaygroundConfigEntity;
293
+ protected documentProvider: FlowDocumentProvider;
294
+ get document(): FlowDocument;
295
+ /**
296
+ * 更新布局
297
+ */
298
+ update(): void;
299
+ syncTransform(node: FlowNodeEntity): void;
300
+ /**
301
+ * 更新所有受影响的上下游节点
302
+ */
303
+ updateAffectedTransform(node: FlowNodeEntity): void;
304
+ /**
305
+ * 获取节点的 padding 数据
306
+ * @param node
307
+ */
308
+ getPadding(node: FlowNodeEntity): PaddingSchema;
309
+ /**
310
+ * 默认滚动到 fitview 区域
311
+ * @param contentSize
312
+ */
313
+ getInitScroll(contentSize: SizeSchema): ScrollSchema;
314
+ /**
315
+ * 获取默认输入点
316
+ */
317
+ getDefaultInputPoint(node: FlowNodeEntity): IPoint;
318
+ /**
319
+ * 获取默认输出点
320
+ */
321
+ getDefaultOutputPoint(node: FlowNodeEntity): IPoint;
322
+ /**
323
+ * 水平中心点
324
+ */
325
+ getDefaultNodeOrigin(): IPoint;
326
+ private getAllParents;
327
+ private getAllBlocks;
328
+ private fireChange;
329
+ }
330
+
286
331
  declare const WorkflowDocumentProvider: unique symbol;
287
332
  type WorkflowDocumentProvider = () => WorkflowDocument;
288
333
  declare class WorkflowDocument extends FlowDocument {
@@ -291,7 +336,6 @@ declare class WorkflowDocument extends FlowDocument {
291
336
  readonly onContentChange: _flowgram_ai_utils.Event<WorkflowContentChangeEvent>;
292
337
  private _onReloadEmitter;
293
338
  readonly onReload: _flowgram_ai_utils.Event<WorkflowDocument>;
294
- private disposed;
295
339
  /**
296
340
  * 数据加载完成
297
341
  */
@@ -322,6 +366,7 @@ declare class WorkflowDocument extends FlowDocument {
322
366
  * @param json
323
367
  */
324
368
  createWorkflowNode(json: WorkflowNodeJSON, isClone?: boolean, parentId?: string): WorkflowNodeEntity;
369
+ get layout(): FreeLayout;
325
370
  /**
326
371
  * 获取默认的 x y 坐标, 默认为当前画布可视区域中心
327
372
  * @param type
@@ -367,19 +412,16 @@ declare class WorkflowDocument extends FlowDocument {
367
412
  */
368
413
  toJSON(): WorkflowJSON;
369
414
  dispose(): void;
370
- private getEdgeID;
371
- /**
372
- * 拍平树形json结构,将结构信息提取到map
373
- */
374
- private flatJSON;
375
- /**
376
- * 对JSON进行分层
377
- */
378
- private nestJSON;
379
415
  /**
380
416
  * 逐层创建节点和线条
381
417
  */
382
- private renderJSON;
418
+ renderJSON(json: WorkflowJSON, options?: {
419
+ parent?: WorkflowNodeEntity;
420
+ isClone?: boolean;
421
+ }): {
422
+ nodes: WorkflowNodeEntity[];
423
+ edges: WorkflowLineEntity[];
424
+ };
383
425
  private getNodeSubCanvas;
384
426
  private getNodeChildren;
385
427
  private toLineJSON;
@@ -669,4 +711,4 @@ declare class WorkflowLineEntity extends Entity<WorkflowLineEntityOpts> {
669
711
  fireRender(): void;
670
712
  }
671
713
 
672
- export { type NodesDraggingEvent as A, type onDragLineEndParams as B, LINE_HOVER_DISTANCE as C, type WorkflowLinePortInfo as D, type WorkflowLineEntityOpts as E, type WorkflowLineInfo as F, PORT_SIZE as G, type WorkflowPortEntityOpts as H, type WorkfloEntityHoverable as I, WorkflowDocumentProvider as J, WorkflowDocumentOptionsDefault as K, type LineEventProps as L, type NodesDragEvent as N, type OnDragLineEnd as O, POINT_RADIUS as P, WorkflowHoverService as W, WorkflowDocument as a, WorkflowLinesManager as b, WorkflowSelectService as c, WorkflowDocumentOptions as d, type WorkflowNodeJSON as e, WorkflowPortEntity as f, WorkflowLineEntity as g, type WorkflowPorts as h, type WorkflowPortType as i, type WorkflowPort as j, type LineRenderType as k, type WorkflowLineRenderContribution as l, type LinePosition as m, getPortEntityId as n, WORKFLOW_LINE_ENTITY as o, domReactToBounds as p, type WorkflowJSON as q, WorkflowContentChangeType as r, type WorkflowContentChangeEvent as s, type WorkflowNodeMeta as t, LineType as u, type LineColor as v, LineColors as w, type WorkflowLineRenderContributionFactory as x, type NodesDragStartEvent as y, type NodesDragEndEvent as z };
714
+ export { type NodesDraggingEvent as A, type onDragLineEndParams as B, LINE_HOVER_DISTANCE as C, type WorkflowLinePortInfo as D, type WorkflowLineEntityOpts as E, type WorkflowLineInfo as F, PORT_SIZE as G, type WorkflowPortEntityOpts as H, type WorkflowEntityHoverable as I, type WorkfloEntityHoverable as J, WorkflowDocumentProvider as K, type LineEventProps as L, WorkflowDocumentOptionsDefault as M, type NodesDragEvent as N, type OnDragLineEnd as O, POINT_RADIUS as P, WorkflowHoverService as W, WorkflowDocument as a, WorkflowLinesManager as b, WorkflowSelectService as c, WorkflowDocumentOptions as d, type WorkflowNodeJSON as e, WorkflowPortEntity as f, WorkflowLineEntity as g, type WorkflowPorts as h, type WorkflowPortType as i, type WorkflowPort as j, type LineRenderType as k, type WorkflowLineRenderContribution as l, type LinePosition as m, getPortEntityId as n, WORKFLOW_LINE_ENTITY as o, domReactToBounds as p, type WorkflowJSON as q, WorkflowContentChangeType as r, type WorkflowContentChangeEvent as s, type WorkflowNodeMeta as t, LineType as u, type LineColor as v, LineColors as w, type WorkflowLineRenderContributionFactory as x, type NodesDragStartEvent as y, type NodesDragEndEvent as z };
@@ -1,7 +1,7 @@
1
1
  import * as _flowgram_ai_utils from '@flowgram.ai/utils';
2
- import { IPoint, Rectangle, PositionSchema, Emitter, Event, DisposableCollection } from '@flowgram.ai/utils';
2
+ import { IPoint, Rectangle, PositionSchema, Emitter, Event, PaddingSchema, SizeSchema, ScrollSchema, DisposableCollection } from '@flowgram.ai/utils';
3
3
  import { PlaygroundDragEvent, PlaygroundDrag, EntityManager, SelectionService, Playground, Entity, PlaygroundConfigEntity, PlaygroundContext, EntityOpts } from '@flowgram.ai/core';
4
- import { FlowNodeMeta, FlowNodeJSON, FlowNodeEntity, FlowDocumentOptions, FlowDocument } from '@flowgram.ai/document';
4
+ import { FlowNodeMeta, FlowNodeJSON, FlowNodeEntity, FlowDocumentOptions, FlowLayout, FlowDocumentProvider, FlowDocument } from '@flowgram.ai/document';
5
5
  import { W as WorkflowNodeEntity, a as WorkflowSubCanvas } from './workflow-sub-canvas-DOVla1mw.js';
6
6
  import { NodeEngineContext } from '@flowgram.ai/form-core';
7
7
  import { WorkflowEdgeJSON } from './typings/workflow-edge.js';
@@ -136,7 +136,6 @@ interface INodesDragEvent {
136
136
  type: string;
137
137
  nodes: FlowNodeEntity[];
138
138
  startPositions: PositionSchema[];
139
- altKey: boolean;
140
139
  dragEvent: PlaygroundDragEvent;
141
140
  triggerEvent: MouseEvent | React.MouseEvent;
142
141
  dragger: PlaygroundDrag;
@@ -214,7 +213,9 @@ declare const WorkflowDocumentOptionsDefault: WorkflowDocumentOptions;
214
213
  /**
215
214
  * 可 Hover 的节点 类型
216
215
  */
217
- type WorkfloEntityHoverable = WorkflowNodeEntity | WorkflowLineEntity | WorkflowPortEntity;
216
+ type WorkflowEntityHoverable = WorkflowNodeEntity | WorkflowLineEntity | WorkflowPortEntity;
217
+ /** @deprecated */
218
+ type WorkfloEntityHoverable = WorkflowEntityHoverable;
218
219
  /**
219
220
  * hover 状态管理
220
221
  */
@@ -283,6 +284,50 @@ declare class WorkflowSelectService {
283
284
  selectNodeAndFocus(node: WorkflowNodeEntity): void;
284
285
  }
285
286
 
287
+ /**
288
+ * 自由画布布局
289
+ */
290
+ declare class FreeLayout implements FlowLayout {
291
+ name: string;
292
+ playgroundConfig: PlaygroundConfigEntity;
293
+ protected documentProvider: FlowDocumentProvider;
294
+ get document(): FlowDocument;
295
+ /**
296
+ * 更新布局
297
+ */
298
+ update(): void;
299
+ syncTransform(node: FlowNodeEntity): void;
300
+ /**
301
+ * 更新所有受影响的上下游节点
302
+ */
303
+ updateAffectedTransform(node: FlowNodeEntity): void;
304
+ /**
305
+ * 获取节点的 padding 数据
306
+ * @param node
307
+ */
308
+ getPadding(node: FlowNodeEntity): PaddingSchema;
309
+ /**
310
+ * 默认滚动到 fitview 区域
311
+ * @param contentSize
312
+ */
313
+ getInitScroll(contentSize: SizeSchema): ScrollSchema;
314
+ /**
315
+ * 获取默认输入点
316
+ */
317
+ getDefaultInputPoint(node: FlowNodeEntity): IPoint;
318
+ /**
319
+ * 获取默认输出点
320
+ */
321
+ getDefaultOutputPoint(node: FlowNodeEntity): IPoint;
322
+ /**
323
+ * 水平中心点
324
+ */
325
+ getDefaultNodeOrigin(): IPoint;
326
+ private getAllParents;
327
+ private getAllBlocks;
328
+ private fireChange;
329
+ }
330
+
286
331
  declare const WorkflowDocumentProvider: unique symbol;
287
332
  type WorkflowDocumentProvider = () => WorkflowDocument;
288
333
  declare class WorkflowDocument extends FlowDocument {
@@ -291,7 +336,6 @@ declare class WorkflowDocument extends FlowDocument {
291
336
  readonly onContentChange: _flowgram_ai_utils.Event<WorkflowContentChangeEvent>;
292
337
  private _onReloadEmitter;
293
338
  readonly onReload: _flowgram_ai_utils.Event<WorkflowDocument>;
294
- private disposed;
295
339
  /**
296
340
  * 数据加载完成
297
341
  */
@@ -322,6 +366,7 @@ declare class WorkflowDocument extends FlowDocument {
322
366
  * @param json
323
367
  */
324
368
  createWorkflowNode(json: WorkflowNodeJSON, isClone?: boolean, parentId?: string): WorkflowNodeEntity;
369
+ get layout(): FreeLayout;
325
370
  /**
326
371
  * 获取默认的 x y 坐标, 默认为当前画布可视区域中心
327
372
  * @param type
@@ -367,19 +412,16 @@ declare class WorkflowDocument extends FlowDocument {
367
412
  */
368
413
  toJSON(): WorkflowJSON;
369
414
  dispose(): void;
370
- private getEdgeID;
371
- /**
372
- * 拍平树形json结构,将结构信息提取到map
373
- */
374
- private flatJSON;
375
- /**
376
- * 对JSON进行分层
377
- */
378
- private nestJSON;
379
415
  /**
380
416
  * 逐层创建节点和线条
381
417
  */
382
- private renderJSON;
418
+ renderJSON(json: WorkflowJSON, options?: {
419
+ parent?: WorkflowNodeEntity;
420
+ isClone?: boolean;
421
+ }): {
422
+ nodes: WorkflowNodeEntity[];
423
+ edges: WorkflowLineEntity[];
424
+ };
383
425
  private getNodeSubCanvas;
384
426
  private getNodeChildren;
385
427
  private toLineJSON;
@@ -669,4 +711,4 @@ declare class WorkflowLineEntity extends Entity<WorkflowLineEntityOpts> {
669
711
  fireRender(): void;
670
712
  }
671
713
 
672
- export { type NodesDraggingEvent as A, type onDragLineEndParams as B, LINE_HOVER_DISTANCE as C, type WorkflowLinePortInfo as D, type WorkflowLineEntityOpts as E, type WorkflowLineInfo as F, PORT_SIZE as G, type WorkflowPortEntityOpts as H, type WorkfloEntityHoverable as I, WorkflowDocumentProvider as J, WorkflowDocumentOptionsDefault as K, type LineEventProps as L, type NodesDragEvent as N, type OnDragLineEnd as O, POINT_RADIUS as P, WorkflowHoverService as W, WorkflowDocument as a, WorkflowLinesManager as b, WorkflowSelectService as c, WorkflowDocumentOptions as d, type WorkflowNodeJSON as e, WorkflowPortEntity as f, WorkflowLineEntity as g, type WorkflowPorts as h, type WorkflowPortType as i, type WorkflowPort as j, type LineRenderType as k, type WorkflowLineRenderContribution as l, type LinePosition as m, getPortEntityId as n, WORKFLOW_LINE_ENTITY as o, domReactToBounds as p, type WorkflowJSON as q, WorkflowContentChangeType as r, type WorkflowContentChangeEvent as s, type WorkflowNodeMeta as t, LineType as u, type LineColor as v, LineColors as w, type WorkflowLineRenderContributionFactory as x, type NodesDragStartEvent as y, type NodesDragEndEvent as z };
714
+ export { type NodesDraggingEvent as A, type onDragLineEndParams as B, LINE_HOVER_DISTANCE as C, type WorkflowLinePortInfo as D, type WorkflowLineEntityOpts as E, type WorkflowLineInfo as F, PORT_SIZE as G, type WorkflowPortEntityOpts as H, type WorkflowEntityHoverable as I, type WorkfloEntityHoverable as J, WorkflowDocumentProvider as K, type LineEventProps as L, WorkflowDocumentOptionsDefault as M, type NodesDragEvent as N, type OnDragLineEnd as O, POINT_RADIUS as P, WorkflowHoverService as W, WorkflowDocument as a, WorkflowLinesManager as b, WorkflowSelectService as c, WorkflowDocumentOptions as d, type WorkflowNodeJSON as e, WorkflowPortEntity as f, WorkflowLineEntity as g, type WorkflowPorts as h, type WorkflowPortType as i, type WorkflowPort as j, type LineRenderType as k, type WorkflowLineRenderContribution as l, type LinePosition as m, getPortEntityId as n, WORKFLOW_LINE_ENTITY as o, domReactToBounds as p, type WorkflowJSON as q, WorkflowContentChangeType as r, type WorkflowContentChangeEvent as s, type WorkflowNodeMeta as t, LineType as u, type LineColor as v, LineColors as w, type WorkflowLineRenderContributionFactory as x, type NodesDragStartEvent as y, type NodesDragEndEvent as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowgram.ai/free-layout-core",
3
- "version": "0.1.0-alpha.6",
3
+ "version": "0.1.0-alpha.8",
4
4
  "homepage": "https://flowgram.ai/",
5
5
  "repository": "https://github.com/bytedance/flowgram.ai",
6
6
  "license": "MIT",
@@ -34,12 +34,12 @@
34
34
  "reflect-metadata": "~0.2.2",
35
35
  "lodash-es": "^4.17.21",
36
36
  "nanoid": "^4.0.2",
37
- "@flowgram.ai/core": "0.1.0-alpha.6",
38
- "@flowgram.ai/document": "0.1.0-alpha.6",
39
- "@flowgram.ai/form-core": "0.1.0-alpha.6",
40
- "@flowgram.ai/node": "0.1.0-alpha.6",
41
- "@flowgram.ai/reactive": "0.1.0-alpha.6",
42
- "@flowgram.ai/utils": "0.1.0-alpha.6"
37
+ "@flowgram.ai/document": "0.1.0-alpha.8",
38
+ "@flowgram.ai/core": "0.1.0-alpha.8",
39
+ "@flowgram.ai/node": "0.1.0-alpha.8",
40
+ "@flowgram.ai/reactive": "0.1.0-alpha.8",
41
+ "@flowgram.ai/form-core": "0.1.0-alpha.8",
42
+ "@flowgram.ai/utils": "0.1.0-alpha.8"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@testing-library/react": "^12",
@@ -53,12 +53,12 @@
53
53
  "tsup": "^8.0.1",
54
54
  "typescript": "^5.0.4",
55
55
  "vitest": "^0.34.6",
56
- "@flowgram.ai/eslint-config": "0.1.0-alpha.6",
57
- "@flowgram.ai/ts-config": "0.1.0-alpha.6"
56
+ "@flowgram.ai/eslint-config": "0.1.0-alpha.8",
57
+ "@flowgram.ai/ts-config": "0.1.0-alpha.8"
58
58
  },
59
59
  "peerDependencies": {
60
- "react": ">=17",
61
- "react-dom": ">=17"
60
+ "react": ">=16.8",
61
+ "react-dom": ">=16.8"
62
62
  },
63
63
  "publishConfig": {
64
64
  "access": "public",