@flowgram.ai/document 0.5.2 → 0.5.4

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/index.d.mts CHANGED
@@ -842,6 +842,7 @@ interface FlowRendererState {
842
842
  nodeDragIdsWithChildren?: string[];
843
843
  dragLabelSide?: LABEL_SIDE_TYPE;
844
844
  dragging?: boolean;
845
+ isBranch?: boolean;
845
846
  }
846
847
  /**
847
848
  * 渲染相关的全局状态管理
@@ -854,6 +855,8 @@ declare class FlowRendererStateEntity extends ConfigEntity<FlowRendererState, Fl
854
855
  setNodeHovered(node: FlowNodeEntity | undefined): void;
855
856
  get dragging(): boolean | undefined;
856
857
  setDragging(dragging: boolean): void;
858
+ get isBranch(): boolean | undefined;
859
+ setIsBranch(isBranch: boolean): void;
857
860
  getDragLabelSide(): LABEL_SIDE_TYPE | undefined;
858
861
  setDragLabelSide(dragLabelSide?: LABEL_SIDE_TYPE): void;
859
862
  getNodeDroppingId(): string | undefined;
@@ -1317,7 +1320,6 @@ declare enum OperationType {
1317
1320
  moveChildNodes = "moveChildNodes",
1318
1321
  addNodes = "addNodes",
1319
1322
  deleteNodes = "deleteNodes",
1320
- changeNode = "changeNode",
1321
1323
  addChildNode = "addChildNode",
1322
1324
  deleteChildNode = "deleteChildNode",
1323
1325
  addNode = "addNode",
@@ -1387,16 +1389,6 @@ interface DeleteNodesOperation {
1387
1389
  type: OperationType.deleteNodes;
1388
1390
  value: AddOrDeleteNodesOperationValue;
1389
1391
  }
1390
- interface ChangeNodeOperationValue {
1391
- id: string;
1392
- path: string;
1393
- oldValue: any;
1394
- value: any;
1395
- }
1396
- interface ChangeNodeOperation {
1397
- type: OperationType.changeNode;
1398
- value: ChangeNodeOperationValue;
1399
- }
1400
1392
  interface MoveChildNodesOperationValue {
1401
1393
  nodeIds: string[];
1402
1394
  fromParentId: string;
@@ -1448,7 +1440,7 @@ interface AddOrDeleteNodeValue {
1448
1440
  index?: number;
1449
1441
  hidden?: boolean;
1450
1442
  }
1451
- type FlowOperation = AddFromNodeOperation | DeleteFromNodeOperation | AddBlockOperation | DeleteBlockOperation | CreateGroupOperation | UngroupOperation | MoveNodesOperation | AddNodesOperation | DeleteNodesOperation | ChangeNodeOperation | MoveBlockOperation | AddChildNodeOperation | DeleteChildNodeOperation | MoveChildNodesOperation | AddNodeOperation | DeleteNodeOperation;
1443
+ type FlowOperation = AddFromNodeOperation | DeleteFromNodeOperation | AddBlockOperation | DeleteBlockOperation | CreateGroupOperation | UngroupOperation | MoveNodesOperation | AddNodesOperation | DeleteNodesOperation | MoveBlockOperation | AddChildNodeOperation | DeleteChildNodeOperation | MoveChildNodesOperation | AddNodeOperation | DeleteNodeOperation;
1452
1444
  type FlowNodeEntityOrId = string | FlowNodeEntity;
1453
1445
  type AddNodeConfig = {
1454
1446
  parent?: FlowNodeEntityOrId;
@@ -1727,4 +1719,4 @@ declare class FlowGroupService {
1727
1719
  */
1728
1720
  declare const getDefaultSpacing: (node: FlowNodeEntity, key: string, defaultSpacing?: number) => any;
1729
1721
 
1730
- export { type AddBlockConfig, type AddBlockOperation, type AddChildNodeOperation, type AddFromNodeOperation, type AddNodeConfig, type AddNodeData, type AddNodeOperation, type AddNodesOperation, type AddOrDeleteBlockValue, type AddOrDeleteChildNodeValue, type AddOrDeleteFromNodeOperationValue, type AddOrDeleteNodeOperationValue, type AddOrDeleteNodeValue, type AddOrDeleteNodesOperationValue, type AdderProps, type ChangeNodeOperation, type ChangeNodeOperationValue, type CollapseAdderProps, type CollapseProps, ConstantKeys, type CreateGroupOperation, type CustomLabelProps, DEFAULT_FLOW_NODE_META, DEFAULT_SIZE, DEFAULT_SPACING, DRAGGING_TYPE, DefaultSpacingKey, type DeleteBlockOperation, type DeleteChildNodeOperation, type DeleteFromNodeOperation, type DeleteNodeOperation, type DeleteNodesOperation, type DragNodeProps, FLOW_DEFAULT_HIDDEN_TYPES, FlowDocument, FlowDocumentConfig, FlowDocumentConfigDefaultData, FlowDocumentConfigEnum, FlowDocumentContainerModule, FlowDocumentContribution, type FlowDocumentJSON, FlowDocumentOptions, FlowDocumentOptionsDefault, FlowDocumentProvider, FlowDocumentTransformerEntity, FlowDragService, FlowGroupController, type FlowGroupJSON, FlowGroupService, FlowLayout, FlowLayoutContribution, FlowLayoutDefault, FlowNodeBaseType, FlowNodeEntity, type FlowNodeEntityConfig, type FlowNodeEntityOrId, type FlowNodeInitData, type FlowNodeJSON, type FlowNodeMeta, FlowNodeRegistry, FlowNodeRenderData, type FlowNodeRenderSchema, FlowNodeSplitType, FlowNodeTransformData, type FlowNodeTransformSchema, FlowNodeTransitionData, type FlowNodeTransitionSchema, type FlowNodeType, type FlowOperation, FlowOperationBaseService, FlowOperationBaseServiceImpl, FlowRendererStateEntity, type FlowTransitionLabel, FlowTransitionLabelEnum, type FlowTransitionLine, FlowTransitionLineEnum, FlowVirtualTree, LABEL_SIDE_TYPE, type MoveBlockOperation, type MoveBlockOperationValue, type MoveChildNodesOperation, type MoveChildNodesOperationValue, type MoveNodeConfig, type MoveNodesOperation, type MoveNodesOperationValue, type OnNodeAddEvent, type OnNodeMoveEvent, OperationType, type UngroupOperation, type Vertex, type createOrUngroupValue, drawLineToBottom, drawLineToNext, getDefaultSpacing };
1722
+ export { type AddBlockConfig, type AddBlockOperation, type AddChildNodeOperation, type AddFromNodeOperation, type AddNodeConfig, type AddNodeData, type AddNodeOperation, type AddNodesOperation, type AddOrDeleteBlockValue, type AddOrDeleteChildNodeValue, type AddOrDeleteFromNodeOperationValue, type AddOrDeleteNodeOperationValue, type AddOrDeleteNodeValue, type AddOrDeleteNodesOperationValue, type AdderProps, type CollapseAdderProps, type CollapseProps, ConstantKeys, type CreateGroupOperation, type CustomLabelProps, DEFAULT_FLOW_NODE_META, DEFAULT_SIZE, DEFAULT_SPACING, DRAGGING_TYPE, DefaultSpacingKey, type DeleteBlockOperation, type DeleteChildNodeOperation, type DeleteFromNodeOperation, type DeleteNodeOperation, type DeleteNodesOperation, type DragNodeProps, FLOW_DEFAULT_HIDDEN_TYPES, FlowDocument, FlowDocumentConfig, FlowDocumentConfigDefaultData, FlowDocumentConfigEnum, FlowDocumentContainerModule, FlowDocumentContribution, type FlowDocumentJSON, FlowDocumentOptions, FlowDocumentOptionsDefault, FlowDocumentProvider, FlowDocumentTransformerEntity, FlowDragService, FlowGroupController, type FlowGroupJSON, FlowGroupService, FlowLayout, FlowLayoutContribution, FlowLayoutDefault, FlowNodeBaseType, FlowNodeEntity, type FlowNodeEntityConfig, type FlowNodeEntityOrId, type FlowNodeInitData, type FlowNodeJSON, type FlowNodeMeta, FlowNodeRegistry, FlowNodeRenderData, type FlowNodeRenderSchema, FlowNodeSplitType, FlowNodeTransformData, type FlowNodeTransformSchema, FlowNodeTransitionData, type FlowNodeTransitionSchema, type FlowNodeType, type FlowOperation, FlowOperationBaseService, FlowOperationBaseServiceImpl, FlowRendererStateEntity, type FlowTransitionLabel, FlowTransitionLabelEnum, type FlowTransitionLine, FlowTransitionLineEnum, FlowVirtualTree, LABEL_SIDE_TYPE, type MoveBlockOperation, type MoveBlockOperationValue, type MoveChildNodesOperation, type MoveChildNodesOperationValue, type MoveNodeConfig, type MoveNodesOperation, type MoveNodesOperationValue, type OnNodeAddEvent, type OnNodeMoveEvent, OperationType, type UngroupOperation, type Vertex, type createOrUngroupValue, drawLineToBottom, drawLineToNext, getDefaultSpacing };
package/dist/index.d.ts CHANGED
@@ -842,6 +842,7 @@ interface FlowRendererState {
842
842
  nodeDragIdsWithChildren?: string[];
843
843
  dragLabelSide?: LABEL_SIDE_TYPE;
844
844
  dragging?: boolean;
845
+ isBranch?: boolean;
845
846
  }
846
847
  /**
847
848
  * 渲染相关的全局状态管理
@@ -854,6 +855,8 @@ declare class FlowRendererStateEntity extends ConfigEntity<FlowRendererState, Fl
854
855
  setNodeHovered(node: FlowNodeEntity | undefined): void;
855
856
  get dragging(): boolean | undefined;
856
857
  setDragging(dragging: boolean): void;
858
+ get isBranch(): boolean | undefined;
859
+ setIsBranch(isBranch: boolean): void;
857
860
  getDragLabelSide(): LABEL_SIDE_TYPE | undefined;
858
861
  setDragLabelSide(dragLabelSide?: LABEL_SIDE_TYPE): void;
859
862
  getNodeDroppingId(): string | undefined;
@@ -1317,7 +1320,6 @@ declare enum OperationType {
1317
1320
  moveChildNodes = "moveChildNodes",
1318
1321
  addNodes = "addNodes",
1319
1322
  deleteNodes = "deleteNodes",
1320
- changeNode = "changeNode",
1321
1323
  addChildNode = "addChildNode",
1322
1324
  deleteChildNode = "deleteChildNode",
1323
1325
  addNode = "addNode",
@@ -1387,16 +1389,6 @@ interface DeleteNodesOperation {
1387
1389
  type: OperationType.deleteNodes;
1388
1390
  value: AddOrDeleteNodesOperationValue;
1389
1391
  }
1390
- interface ChangeNodeOperationValue {
1391
- id: string;
1392
- path: string;
1393
- oldValue: any;
1394
- value: any;
1395
- }
1396
- interface ChangeNodeOperation {
1397
- type: OperationType.changeNode;
1398
- value: ChangeNodeOperationValue;
1399
- }
1400
1392
  interface MoveChildNodesOperationValue {
1401
1393
  nodeIds: string[];
1402
1394
  fromParentId: string;
@@ -1448,7 +1440,7 @@ interface AddOrDeleteNodeValue {
1448
1440
  index?: number;
1449
1441
  hidden?: boolean;
1450
1442
  }
1451
- type FlowOperation = AddFromNodeOperation | DeleteFromNodeOperation | AddBlockOperation | DeleteBlockOperation | CreateGroupOperation | UngroupOperation | MoveNodesOperation | AddNodesOperation | DeleteNodesOperation | ChangeNodeOperation | MoveBlockOperation | AddChildNodeOperation | DeleteChildNodeOperation | MoveChildNodesOperation | AddNodeOperation | DeleteNodeOperation;
1443
+ type FlowOperation = AddFromNodeOperation | DeleteFromNodeOperation | AddBlockOperation | DeleteBlockOperation | CreateGroupOperation | UngroupOperation | MoveNodesOperation | AddNodesOperation | DeleteNodesOperation | MoveBlockOperation | AddChildNodeOperation | DeleteChildNodeOperation | MoveChildNodesOperation | AddNodeOperation | DeleteNodeOperation;
1452
1444
  type FlowNodeEntityOrId = string | FlowNodeEntity;
1453
1445
  type AddNodeConfig = {
1454
1446
  parent?: FlowNodeEntityOrId;
@@ -1727,4 +1719,4 @@ declare class FlowGroupService {
1727
1719
  */
1728
1720
  declare const getDefaultSpacing: (node: FlowNodeEntity, key: string, defaultSpacing?: number) => any;
1729
1721
 
1730
- export { type AddBlockConfig, type AddBlockOperation, type AddChildNodeOperation, type AddFromNodeOperation, type AddNodeConfig, type AddNodeData, type AddNodeOperation, type AddNodesOperation, type AddOrDeleteBlockValue, type AddOrDeleteChildNodeValue, type AddOrDeleteFromNodeOperationValue, type AddOrDeleteNodeOperationValue, type AddOrDeleteNodeValue, type AddOrDeleteNodesOperationValue, type AdderProps, type ChangeNodeOperation, type ChangeNodeOperationValue, type CollapseAdderProps, type CollapseProps, ConstantKeys, type CreateGroupOperation, type CustomLabelProps, DEFAULT_FLOW_NODE_META, DEFAULT_SIZE, DEFAULT_SPACING, DRAGGING_TYPE, DefaultSpacingKey, type DeleteBlockOperation, type DeleteChildNodeOperation, type DeleteFromNodeOperation, type DeleteNodeOperation, type DeleteNodesOperation, type DragNodeProps, FLOW_DEFAULT_HIDDEN_TYPES, FlowDocument, FlowDocumentConfig, FlowDocumentConfigDefaultData, FlowDocumentConfigEnum, FlowDocumentContainerModule, FlowDocumentContribution, type FlowDocumentJSON, FlowDocumentOptions, FlowDocumentOptionsDefault, FlowDocumentProvider, FlowDocumentTransformerEntity, FlowDragService, FlowGroupController, type FlowGroupJSON, FlowGroupService, FlowLayout, FlowLayoutContribution, FlowLayoutDefault, FlowNodeBaseType, FlowNodeEntity, type FlowNodeEntityConfig, type FlowNodeEntityOrId, type FlowNodeInitData, type FlowNodeJSON, type FlowNodeMeta, FlowNodeRegistry, FlowNodeRenderData, type FlowNodeRenderSchema, FlowNodeSplitType, FlowNodeTransformData, type FlowNodeTransformSchema, FlowNodeTransitionData, type FlowNodeTransitionSchema, type FlowNodeType, type FlowOperation, FlowOperationBaseService, FlowOperationBaseServiceImpl, FlowRendererStateEntity, type FlowTransitionLabel, FlowTransitionLabelEnum, type FlowTransitionLine, FlowTransitionLineEnum, FlowVirtualTree, LABEL_SIDE_TYPE, type MoveBlockOperation, type MoveBlockOperationValue, type MoveChildNodesOperation, type MoveChildNodesOperationValue, type MoveNodeConfig, type MoveNodesOperation, type MoveNodesOperationValue, type OnNodeAddEvent, type OnNodeMoveEvent, OperationType, type UngroupOperation, type Vertex, type createOrUngroupValue, drawLineToBottom, drawLineToNext, getDefaultSpacing };
1722
+ export { type AddBlockConfig, type AddBlockOperation, type AddChildNodeOperation, type AddFromNodeOperation, type AddNodeConfig, type AddNodeData, type AddNodeOperation, type AddNodesOperation, type AddOrDeleteBlockValue, type AddOrDeleteChildNodeValue, type AddOrDeleteFromNodeOperationValue, type AddOrDeleteNodeOperationValue, type AddOrDeleteNodeValue, type AddOrDeleteNodesOperationValue, type AdderProps, type CollapseAdderProps, type CollapseProps, ConstantKeys, type CreateGroupOperation, type CustomLabelProps, DEFAULT_FLOW_NODE_META, DEFAULT_SIZE, DEFAULT_SPACING, DRAGGING_TYPE, DefaultSpacingKey, type DeleteBlockOperation, type DeleteChildNodeOperation, type DeleteFromNodeOperation, type DeleteNodeOperation, type DeleteNodesOperation, type DragNodeProps, FLOW_DEFAULT_HIDDEN_TYPES, FlowDocument, FlowDocumentConfig, FlowDocumentConfigDefaultData, FlowDocumentConfigEnum, FlowDocumentContainerModule, FlowDocumentContribution, type FlowDocumentJSON, FlowDocumentOptions, FlowDocumentOptionsDefault, FlowDocumentProvider, FlowDocumentTransformerEntity, FlowDragService, FlowGroupController, type FlowGroupJSON, FlowGroupService, FlowLayout, FlowLayoutContribution, FlowLayoutDefault, FlowNodeBaseType, FlowNodeEntity, type FlowNodeEntityConfig, type FlowNodeEntityOrId, type FlowNodeInitData, type FlowNodeJSON, type FlowNodeMeta, FlowNodeRegistry, FlowNodeRenderData, type FlowNodeRenderSchema, FlowNodeSplitType, FlowNodeTransformData, type FlowNodeTransformSchema, FlowNodeTransitionData, type FlowNodeTransitionSchema, type FlowNodeType, type FlowOperation, FlowOperationBaseService, FlowOperationBaseServiceImpl, FlowRendererStateEntity, type FlowTransitionLabel, FlowTransitionLabelEnum, type FlowTransitionLine, FlowTransitionLineEnum, FlowVirtualTree, LABEL_SIDE_TYPE, type MoveBlockOperation, type MoveBlockOperationValue, type MoveChildNodesOperation, type MoveChildNodesOperationValue, type MoveNodeConfig, type MoveNodesOperation, type MoveNodesOperationValue, type OnNodeAddEvent, type OnNodeMoveEvent, OperationType, type UngroupOperation, type Vertex, type createOrUngroupValue, drawLineToBottom, drawLineToNext, getDefaultSpacing };
package/dist/index.js CHANGED
@@ -303,7 +303,6 @@ var OperationType = /* @__PURE__ */ ((OperationType2) => {
303
303
  OperationType2["moveChildNodes"] = "moveChildNodes";
304
304
  OperationType2["addNodes"] = "addNodes";
305
305
  OperationType2["deleteNodes"] = "deleteNodes";
306
- OperationType2["changeNode"] = "changeNode";
307
306
  OperationType2["addChildNode"] = "addChildNode";
308
307
  OperationType2["deleteChildNode"] = "deleteChildNode";
309
308
  OperationType2["addNode"] = "addNode";
@@ -1262,6 +1261,14 @@ var FlowRendererStateEntity = class extends import_core6.ConfigEntity {
1262
1261
  dragging
1263
1262
  });
1264
1263
  }
1264
+ get isBranch() {
1265
+ return this.config.isBranch;
1266
+ }
1267
+ setIsBranch(isBranch) {
1268
+ this.updateConfig({
1269
+ isBranch
1270
+ });
1271
+ }
1265
1272
  getDragLabelSide() {
1266
1273
  return this.config.dragLabelSide;
1267
1274
  }
@@ -2518,7 +2525,7 @@ var FlowDragService = class {
2518
2525
  }
2519
2526
  // 是否在拖拽分支
2520
2527
  get isDragBranch() {
2521
- return this.dragStartNode?.isInlineBlock;
2528
+ return this.renderState.isBranch || this.dragStartNode?.isInlineBlock;
2522
2529
  }
2523
2530
  // 拖拽的所有节点及其自节点
2524
2531
  get nodeDragIdsWithChildren() {
@@ -2609,6 +2616,9 @@ var FlowDragService = class {
2609
2616
  * @param side 分支的前面还是后面
2610
2617
  */
2611
2618
  isDroppableBranch(node, side = "normal_branch" /* NORMAL_BRANCH */) {
2619
+ if (this.renderState.isBranch) {
2620
+ return true;
2621
+ }
2612
2622
  if (this.isDragBranch) {
2613
2623
  if (
2614
2624
  // 拖拽到分支