@flowgram.ai/document 0.5.1 → 0.5.2

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/dist/esm/index.js CHANGED
@@ -1195,6 +1195,14 @@ var FlowRendererStateEntity = class extends ConfigEntity2 {
1195
1195
  nodeHoveredId: node?.id
1196
1196
  });
1197
1197
  }
1198
+ get dragging() {
1199
+ return this.config.dragging;
1200
+ }
1201
+ setDragging(dragging) {
1202
+ this.updateConfig({
1203
+ dragging
1204
+ });
1205
+ }
1198
1206
  getDragLabelSide() {
1199
1207
  return this.config.dragLabelSide;
1200
1208
  }
@@ -2458,8 +2466,7 @@ var FlowDragService = class {
2458
2466
  return this.renderState.config.nodeDragIdsWithChildren || [];
2459
2467
  }
2460
2468
  get dragging() {
2461
- const renderData = this.dragStartNode?.getData(FlowNodeRenderData);
2462
- return !!renderData?.dragging;
2469
+ return !!this.renderState.dragging;
2463
2470
  }
2464
2471
  get labelSide() {
2465
2472
  return this.renderState.config.dragLabelSide;
@@ -2470,6 +2477,24 @@ var FlowDragService = class {
2470
2477
  dropBranch() {
2471
2478
  this.dropNode();
2472
2479
  }
2480
+ /**
2481
+ * 移动并且创建节点
2482
+ * Move and create node
2483
+ */
2484
+ async dropCreateNode(json, onCreateNode) {
2485
+ const dropEntity = this.document.getNode(this.dropNodeId);
2486
+ if (!dropEntity) {
2487
+ return;
2488
+ }
2489
+ if (json) {
2490
+ const dragNodes = await onCreateNode?.(json, dropEntity);
2491
+ this.onDropEmitter.fire({
2492
+ dropNode: dropEntity,
2493
+ dragNodes: dragNodes ? [dragNodes] : [],
2494
+ dragJSON: json
2495
+ });
2496
+ }
2497
+ }
2473
2498
  /**
2474
2499
  * 移动到目标节点
2475
2500
  */