@relation-graph/react 3.0.0 → 3.0.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.
Files changed (234) hide show
  1. package/package.json +2 -2
  2. package/relation-graph.js +252 -24
  3. package/relation-graph.mjs +7412 -5885
  4. package/relation-graph.umd.js +252 -24
  5. package/types/packages/platforms/react/src/index.d.ts +101 -64
  6. package/types/packages/platforms/react/src/relation-graph/RGProvider.d.ts +4 -0
  7. package/types/packages/platforms/react/src/relation-graph/RelationGraph.d.ts +7 -3
  8. package/types/packages/platforms/react/src/relation-graph/RelationLinker.d.ts +4 -5
  9. package/types/packages/platforms/react/src/relation-graph/src/core4react/RGCanvas.d.ts +2 -3
  10. package/types/packages/platforms/react/src/relation-graph/src/core4react/RGCanvasContent.d.ts +10 -3
  11. package/types/packages/platforms/react/src/relation-graph/src/core4react/RGCanvasContent4CreatingLine.d.ts +10 -0
  12. package/types/packages/platforms/react/src/relation-graph/src/core4react/RGCanvasContent4FakeLines.d.ts +11 -0
  13. package/types/packages/platforms/react/src/relation-graph/src/core4react/RGCanvasContent4Lines.d.ts +12 -0
  14. package/types/packages/platforms/react/src/relation-graph/src/core4react/RGCanvasContent4Nodes.d.ts +13 -0
  15. package/types/packages/platforms/react/src/relation-graph/src/core4react/RGFakeNode.d.ts +1 -1
  16. package/types/packages/platforms/react/src/relation-graph/src/core4react/RGGraphRefs.d.ts +0 -1
  17. package/types/packages/platforms/react/src/relation-graph/src/core4react/RGLineContent.d.ts +1 -1
  18. package/types/packages/platforms/react/src/relation-graph/src/core4react/RGLinePath.d.ts +2 -1
  19. package/types/packages/platforms/react/src/relation-graph/src/core4react/RGLinePeel.d.ts +2 -3
  20. package/types/packages/platforms/react/src/relation-graph/src/core4react/RGLineText.d.ts +4 -2
  21. package/types/packages/platforms/react/src/relation-graph/src/core4react/RGNodePeel.d.ts +10 -1
  22. package/types/packages/platforms/react/src/relation-graph/src/core4react/RelationGraphUI.d.ts +4 -0
  23. package/types/packages/platforms/react/src/relation-graph/src/core4react/RelationGraphView.d.ts +4 -0
  24. package/types/packages/platforms/react/src/relation-graph/src/core4react/RelationLinkerCanvas.d.ts +4 -5
  25. package/types/packages/platforms/react/src/relation-graph/src/core4react/RelationLinkerUI.d.ts +4 -0
  26. package/types/packages/platforms/react/src/relation-graph/src/core4react/RelationLinkerView.d.ts +4 -0
  27. package/types/packages/platforms/react/src/relation-graph/src/core4react/editing/RGConnectSource.d.ts +1 -1
  28. package/types/packages/platforms/react/src/relation-graph/src/core4react/editing/RGConnectTarget.d.ts +1 -1
  29. package/types/packages/platforms/react/src/relation-graph/src/core4react/editing/RGEditingConnectPoints.d.ts +1 -1
  30. package/types/packages/platforms/react/src/relation-graph/src/core4react/editing/RGEditingLineController.d.ts +1 -1
  31. package/types/packages/platforms/react/src/relation-graph/src/core4react/editing/RGEditingNearNodeWidget.d.ts +1 -1
  32. package/types/packages/platforms/react/src/relation-graph/src/core4react/editing/RGMiniView.d.ts +1 -1
  33. package/types/packages/platforms/react/src/relation-graph/src/core4react/slots/RGSlotOnLine.d.ts +1 -1
  34. package/types/packages/platforms/react/src/relation-graph/src/core4react/slots/RGSlotOnLineText.d.ts +1 -1
  35. package/types/packages/platforms/react/src/relation-graph/src/core4react/slots/RGSlotOnNode.d.ts +1 -1
  36. package/types/packages/platforms/react/src/relation-graph/src/core4react/store/index.d.ts +3 -2
  37. package/types/packages/platforms/react/src/relation-graph/src/core4react/store/reducers/RGStore.d.ts +10 -0
  38. package/types/packages/platforms/react/src/relation-graph/src/core4react/widgets/GraphBackground.d.ts +1 -1
  39. package/types/packages/platforms/react/src/relation-graph/src/core4react/widgets/GraphOperateStuff.d.ts +1 -1
  40. package/types/packages/platforms/react/src/relation-graph/src/core4react/widgets/GraphToolBar.d.ts +1 -1
  41. package/types/packages/platforms/react/src/relation-graph/src/core4react/widgets/GraphWatermark.d.ts +1 -1
  42. package/types/packages/platforms/react/src/relation-graph/src/core4react/widgets/GraphXsToolBar.d.ts +1 -1
  43. package/types/packages/platforms/react/src/relation-graph/src/core4react/widgets/RGDebugView.d.ts +3 -0
  44. package/types/packages/platforms/react/src/relation-graph/src/hooks/RGDataProvider.d.ts +17 -0
  45. package/types/packages/platforms/react/src/relation-graph/src/hooks/RGHooks.d.ts +24 -1
  46. package/types/packages/platforms/react/src/relation-graph/src/hooks/useFakeNodesState.d.ts +1 -1
  47. package/types/packages/platforms/react/src/relation-graph/src/hooks/useGraphInstance.d.ts +2 -12
  48. package/types/packages/platforms/react/src/relation-graph/src/hooks/useGraphStore.d.ts +13 -0
  49. package/types/packages/platforms/react/src/relation-graph/src/hooks/useRelationGraph.d.ts +11 -0
  50. package/types/packages/platforms/react/src/relation-graph/src/hooks/useRelationLinker.d.ts +17 -0
  51. package/types/packages/platforms/react/src/types-react.d.ts +24 -24
  52. package/types/packages/platforms/svelte/src/RGProvider.svelte.d.ts +1 -0
  53. package/types/packages/platforms/svelte/src/context.d.ts +4 -0
  54. package/types/packages/platforms/svelte/src/core4svelte/RGCanvas.svelte.d.ts +1 -0
  55. package/types/packages/platforms/svelte/src/core4svelte/RGCanvasContent.svelte.d.ts +1 -0
  56. package/types/packages/platforms/svelte/src/core4svelte/RGCanvasContent4CreatingLine.svelte.d.ts +1 -0
  57. package/types/packages/platforms/svelte/src/core4svelte/RGCanvasContent4FakeLines.svelte.d.ts +1 -0
  58. package/types/packages/platforms/svelte/src/core4svelte/RGCanvasContent4Lines.svelte.d.ts +1 -0
  59. package/types/packages/platforms/svelte/src/core4svelte/RGCanvasContent4Nodes.svelte.d.ts +1 -0
  60. package/types/packages/platforms/svelte/src/core4svelte/RGEasyView.svelte.d.ts +1 -0
  61. package/types/packages/platforms/svelte/src/core4svelte/RGFakeNode.svelte.d.ts +1 -0
  62. package/types/packages/platforms/svelte/src/core4svelte/RGGraphDefs.svelte.d.ts +1 -0
  63. package/types/packages/platforms/svelte/src/core4svelte/RGLineContent.svelte.d.ts +1 -0
  64. package/types/packages/platforms/svelte/src/core4svelte/RGLinePath.svelte.d.ts +1 -0
  65. package/types/packages/platforms/svelte/src/core4svelte/RGLinePeel.svelte.d.ts +1 -0
  66. package/types/packages/platforms/svelte/src/core4svelte/RGLineText.svelte.d.ts +1 -0
  67. package/types/packages/platforms/svelte/src/core4svelte/RGNodeExpandHolder.svelte.d.ts +1 -0
  68. package/types/packages/platforms/svelte/src/core4svelte/RGNodePeel.svelte.d.ts +1 -0
  69. package/types/packages/platforms/svelte/src/core4svelte/RGProvider4Instance.svelte.d.ts +1 -0
  70. package/types/packages/platforms/svelte/src/core4svelte/RelationGraph.svelte.d.ts +1 -0
  71. package/types/packages/platforms/svelte/src/core4svelte/RelationGraphUI.svelte.d.ts +1 -0
  72. package/types/packages/platforms/svelte/src/core4svelte/RelationLinker.svelte.d.ts +1 -0
  73. package/types/packages/platforms/svelte/src/core4svelte/RelationLinkerCanvas.svelte.d.ts +1 -0
  74. package/types/packages/platforms/svelte/src/core4svelte/RelationLinkerUI.svelte.d.ts +1 -0
  75. package/types/packages/platforms/svelte/src/core4svelte/editing/RGConnectSource.svelte.d.ts +1 -0
  76. package/types/packages/platforms/svelte/src/core4svelte/editing/RGConnectTarget.svelte.d.ts +1 -0
  77. package/types/packages/platforms/svelte/src/core4svelte/editing/RGConnectTargetUI.svelte.d.ts +1 -0
  78. package/types/packages/platforms/svelte/src/core4svelte/editing/RGEditingConnectController.svelte.d.ts +1 -0
  79. package/types/packages/platforms/svelte/src/core4svelte/editing/RGEditingConnectPoints.svelte.d.ts +1 -0
  80. package/types/packages/platforms/svelte/src/core4svelte/editing/RGEditingLineController.svelte.d.ts +1 -0
  81. package/types/packages/platforms/svelte/src/core4svelte/editing/RGEditingLineControllerUI.svelte.d.ts +1 -0
  82. package/types/packages/platforms/svelte/src/core4svelte/editing/RGEditingNearNodeWidget.svelte.d.ts +1 -0
  83. package/types/packages/platforms/svelte/src/core4svelte/editing/RGEditingNodeController.svelte.d.ts +1 -0
  84. package/types/packages/platforms/svelte/src/core4svelte/editing/RGEditingNodeControllerUI.svelte.d.ts +1 -0
  85. package/types/packages/platforms/svelte/src/core4svelte/editing/RGEditingReferenceLine.svelte.d.ts +1 -0
  86. package/types/packages/platforms/svelte/src/core4svelte/editing/RGEditingResize.svelte.d.ts +1 -0
  87. package/types/packages/platforms/svelte/src/core4svelte/editing/RGEditingResizeUI.svelte.d.ts +1 -0
  88. package/types/packages/platforms/svelte/src/core4svelte/editing/RGMiniView.svelte.d.ts +1 -0
  89. package/types/packages/platforms/svelte/src/core4svelte/editing/RGMiniViewContent.svelte.d.ts +1 -0
  90. package/types/packages/platforms/svelte/src/core4svelte/web-components/RGConnectTarget.svelte.d.ts +1 -0
  91. package/types/packages/platforms/svelte/src/core4svelte/web-components/RGEditingConnectController.svelte.d.ts +1 -0
  92. package/types/packages/platforms/svelte/src/core4svelte/web-components/RGEditingLineController.svelte.d.ts +1 -0
  93. package/types/packages/platforms/svelte/src/core4svelte/web-components/RGEditingNearNodeWidget.svelte.d.ts +1 -0
  94. package/types/packages/platforms/svelte/src/core4svelte/web-components/RGEditingNodeController.svelte.d.ts +1 -0
  95. package/types/packages/platforms/svelte/src/core4svelte/web-components/RGEditingReferenceLine.svelte.d.ts +1 -0
  96. package/types/packages/platforms/svelte/src/core4svelte/web-components/RGEditingResize.svelte.d.ts +1 -0
  97. package/types/packages/platforms/svelte/src/core4svelte/web-components/RGMiniView.svelte.d.ts +1 -0
  98. package/types/packages/platforms/svelte/src/core4svelte/web-components/RelationGraphWithProvider.svelte.d.ts +1 -0
  99. package/types/packages/platforms/svelte/src/core4svelte/web-components/WebComponentUtils.d.ts +11 -0
  100. package/types/packages/platforms/svelte/src/core4svelte/widgets/GraphBackground.svelte.d.ts +1 -0
  101. package/types/packages/platforms/svelte/src/core4svelte/widgets/GraphLoading.svelte.d.ts +1 -0
  102. package/types/packages/platforms/svelte/src/core4svelte/widgets/GraphMoveOperator.svelte.d.ts +1 -0
  103. package/types/packages/platforms/svelte/src/core4svelte/widgets/GraphOperateStuff.svelte.d.ts +1 -0
  104. package/types/packages/platforms/svelte/src/core4svelte/widgets/GraphWatermark.svelte.d.ts +1 -0
  105. package/types/packages/platforms/svelte/src/core4svelte/widgets/GraphXsToolBar.svelte.d.ts +1 -0
  106. package/types/packages/platforms/svelte/src/core4svelte/widgets/RGIcons.svelte.d.ts +1 -0
  107. package/types/packages/platforms/svelte/src/hooks/RGHooks.d.ts +27 -0
  108. package/types/packages/platforms/svelte/src/hooks/useGraphInstance.d.ts +2 -0
  109. package/types/packages/platforms/svelte/src/hooks/useGraphStore.d.ts +14 -0
  110. package/types/packages/platforms/svelte/src/hooks/useRGDataProvider.d.ts +19 -0
  111. package/types/packages/platforms/svelte/src/hooks/useRelationGraph.d.ts +48 -0
  112. package/types/packages/platforms/svelte/src/index.d.ts +194 -0
  113. package/types/packages/platforms/svelte/src/types-svelte.d.ts +85 -0
  114. package/types/packages/platforms/vue2/src/core4vue/RGCanvas.vue.d.ts +2 -6
  115. package/types/packages/platforms/vue2/src/core4vue/RGCanvasContent.vue.d.ts +6 -6
  116. package/types/packages/platforms/vue2/src/core4vue/RGCanvasContent4CreatingLine.vue.d.ts +9 -0
  117. package/types/packages/platforms/vue2/src/core4vue/RGCanvasContent4FakeLines.vue.d.ts +9 -0
  118. package/types/packages/platforms/vue2/src/core4vue/RGCanvasContent4Lines.vue.d.ts +9 -0
  119. package/types/packages/platforms/vue2/src/core4vue/RGCanvasContent4Nodes.vue.d.ts +9 -0
  120. package/types/packages/platforms/vue2/src/core4vue/RGEasyView.vue.d.ts +1 -0
  121. package/types/packages/platforms/vue2/src/core4vue/RGGraphDefs.vue.d.ts +1 -0
  122. package/types/packages/platforms/vue2/src/core4vue/RGLineContent.vue.d.ts +20 -19
  123. package/types/packages/platforms/vue2/src/core4vue/RGLinePath.vue.d.ts +5 -30
  124. package/types/packages/platforms/vue2/src/core4vue/RGLinePeel.vue.d.ts +4 -15
  125. package/types/packages/platforms/vue2/src/core4vue/RGNodeExpandHolder.vue.d.ts +3 -9
  126. package/types/packages/platforms/vue2/src/core4vue/RGNodePeel.vue.d.ts +5 -20
  127. package/types/packages/platforms/vue2/src/core4vue/RGProvider.vue.d.ts +50 -0
  128. package/types/packages/platforms/vue2/src/core4vue/RelationGraph.vue.d.ts +5 -773
  129. package/types/packages/platforms/vue2/src/core4vue/RelationGraphUI.vue.d.ts +46 -0
  130. package/types/packages/platforms/vue2/src/core4vue/RelationLinker.vue.d.ts +8 -24
  131. package/types/packages/platforms/vue2/src/core4vue/RelationLinkerCanvas.vue.d.ts +1 -0
  132. package/types/packages/platforms/vue2/src/core4vue/RelationLinkerUI.vue.d.ts +23 -0
  133. package/types/packages/platforms/vue2/src/core4vue/editing/RGConnectSource.vue.d.ts +3 -1
  134. package/types/packages/platforms/vue2/src/core4vue/editing/RGConnectTarget.vue.d.ts +1 -0
  135. package/types/packages/platforms/vue2/src/core4vue/editing/RGEditingConnectController.vue.d.ts +2 -1
  136. package/types/packages/platforms/vue2/src/core4vue/editing/RGEditingConnectPoints.vue.d.ts +1 -0
  137. package/types/packages/platforms/vue2/src/core4vue/editing/RGEditingLineController.vue.d.ts +12 -2
  138. package/types/packages/platforms/vue2/src/core4vue/editing/RGEditingNearNodeWidget.vue.d.ts +1 -0
  139. package/types/packages/platforms/vue2/src/core4vue/editing/RGEditingNodeController.vue.d.ts +1 -0
  140. package/types/packages/platforms/vue2/src/core4vue/editing/RGEditingReferenceLine.vue.d.ts +1 -0
  141. package/types/packages/platforms/vue2/src/core4vue/editing/RGEditingResize.vue.d.ts +1 -0
  142. package/types/packages/platforms/vue2/src/core4vue/editing/RGMiniView.vue.d.ts +3 -1
  143. package/types/packages/platforms/vue2/src/core4vue/widgets/GraphBackground.vue.d.ts +1 -0
  144. package/types/packages/platforms/vue2/src/core4vue/widgets/GraphLoading.vue.d.ts +1 -0
  145. package/types/packages/platforms/vue2/src/core4vue/widgets/GraphMoveOperator.vue.d.ts +1 -1
  146. package/types/packages/platforms/vue2/src/core4vue/widgets/GraphOperateStuff.vue.d.ts +1 -0
  147. package/types/packages/platforms/vue2/src/core4vue/widgets/GraphToolBar.vue.d.ts +1 -1
  148. package/types/packages/platforms/vue2/src/core4vue/widgets/GraphWatermark.vue.d.ts +1 -0
  149. package/types/packages/platforms/vue2/src/core4vue/widgets/GraphXsToolBar.vue.d.ts +1 -1
  150. package/types/packages/platforms/vue2/src/core4vue/widgets/RGDebugView.vue.d.ts +12 -0
  151. package/types/packages/platforms/vue2/src/hooks/GraphStoreMixin.d.ts +40 -0
  152. package/types/packages/platforms/vue2/src/index.d.ts +139 -1694
  153. package/types/packages/platforms/vue2/src/types-vue2.d.ts +3 -0
  154. package/types/packages/platforms/vue3/src/constants.d.ts +0 -1
  155. package/types/packages/platforms/vue3/src/index.d.ts +97 -1404
  156. package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/editing/RGConnectSource.vue.d.ts +2 -2
  157. package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/editing/RGConnectTarget.vue.d.ts +4 -4
  158. package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/editing/RGEditingLineController.vue.d.ts +2 -2
  159. package/types/packages/platforms/vue3/src/relation-graph/src/hooks/RGHooks.d.ts +27 -2
  160. package/types/packages/platforms/vue3/src/relation-graph/src/hooks/useGraphData.d.ts +2 -0
  161. package/types/packages/platforms/vue3/src/relation-graph/src/hooks/useGraphInstance.d.ts +1 -12
  162. package/types/packages/platforms/vue3/src/relation-graph/src/hooks/useGraphStore.d.ts +16 -0
  163. package/types/packages/platforms/vue3/src/relation-graph/src/hooks/useRGDataProvider.d.ts +17 -0
  164. package/types/packages/platforms/vue3/src/relation-graph/src/hooks/useRelationGraph.d.ts +131 -0
  165. package/types/packages/platforms/vue3/src/relation-graph/src/hooks/useRelationLinker.d.ts +39 -0
  166. package/types/packages/platforms/vue3/src/types-vue3.d.ts +104 -4
  167. package/types/packages/platforms/vue3/src/types.d.ts +3 -1
  168. package/types/packages/relation-graph-models/RGObjectsForExport.d.ts +40 -32
  169. package/types/packages/relation-graph-models/data/RGDataDefine.d.ts +23 -0
  170. package/types/packages/relation-graph-models/data/RGDataGetter.d.ts +36 -0
  171. package/types/packages/relation-graph-models/data/RGDataProvider.d.ts +66 -0
  172. package/types/packages/relation-graph-models/data/RGDataProvider4React.d.ts +9 -0
  173. package/types/packages/relation-graph-models/data/RGDataProvider4Svelte.d.ts +10 -0
  174. package/types/packages/relation-graph-models/data/RGDataProvider4Vue2.d.ts +9 -0
  175. package/types/packages/relation-graph-models/data/RGDataProvider4Vue3.d.ts +10 -0
  176. package/types/packages/relation-graph-models/data/RGDataProvider4Vue3V1.d.ts +10 -0
  177. package/types/packages/relation-graph-models/data/RGLineDataUtils.d.ts +9 -0
  178. package/types/packages/relation-graph-models/data/RGNodeDataUtils.d.ts +17 -0
  179. package/types/packages/relation-graph-models/data/RGOptionsDataUtils.d.ts +9 -0
  180. package/types/packages/relation-graph-models/data/utils/EdgeCounter.d.ts +8 -0
  181. package/types/packages/relation-graph-models/layouts/RGBaseLayout.d.ts +37 -0
  182. package/types/packages/relation-graph-models/layouts/RGCenterLayout.d.ts +9 -0
  183. package/types/packages/relation-graph-models/layouts/RGCircleLayout.d.ts +7 -0
  184. package/types/packages/relation-graph-models/layouts/RGFixedLayout.d.ts +10 -0
  185. package/types/packages/relation-graph-models/layouts/RGFolderLayout.d.ts +15 -0
  186. package/types/packages/relation-graph-models/layouts/RGForceLayout.d.ts +77 -0
  187. package/types/packages/relation-graph-models/layouts/RGIOTreeLayout.d.ts +18 -0
  188. package/types/packages/relation-graph-models/layouts/RGSmartTreeLayout.d.ts +14 -0
  189. package/types/packages/relation-graph-models/layouts/RGTreeLayout.d.ts +17 -0
  190. package/types/packages/relation-graph-models/layouts/analyzers/BasicNetworkAnalyzer.d.ts +27 -0
  191. package/types/packages/relation-graph-models/layouts/analyzers/RGNetworkAnalyzer.d.ts +27 -0
  192. package/types/packages/relation-graph-models/models/RelationGraphBase.d.ts +31 -18
  193. package/types/packages/relation-graph-models/models/RelationGraphCore.d.ts +46 -0
  194. package/types/packages/relation-graph-models/models/RelationGraphWith1View.d.ts +91 -0
  195. package/types/packages/relation-graph-models/models/RelationGraphWith2Data.d.ts +34 -381
  196. package/types/packages/relation-graph-models/models/RelationGraphWith2Data1Getter.d.ts +84 -0
  197. package/types/packages/relation-graph-models/models/RelationGraphWith2Data2Analysis.d.ts +177 -0
  198. package/types/packages/relation-graph-models/models/RelationGraphWith2Data3Update.d.ts +259 -0
  199. package/types/packages/relation-graph-models/models/RelationGraphWith2Data4ConnectTarget.d.ts +85 -0
  200. package/types/packages/relation-graph-models/models/RelationGraphWith2Data5LineConfig.d.ts +35 -0
  201. package/types/packages/relation-graph-models/models/RelationGraphWith3Options1Update.d.ts +75 -0
  202. package/types/packages/relation-graph-models/models/RelationGraphWith3Options2API.d.ts +39 -0
  203. package/types/packages/relation-graph-models/models/RelationGraphWith4Line.d.ts +86 -23
  204. package/types/packages/relation-graph-models/models/RelationGraphWith5Zoom.d.ts +19 -21
  205. package/types/packages/relation-graph-models/models/RelationGraphWith6Effect.d.ts +56 -4
  206. package/types/packages/relation-graph-models/models/RelationGraphWith6Layout.d.ts +60 -12
  207. package/types/packages/relation-graph-models/models/RelationGraphWith7Event.d.ts +233 -37
  208. package/types/packages/relation-graph-models/models/RelationGraphWith91Editing.d.ts +176 -25
  209. package/types/packages/relation-graph-models/models/RelationGraphWith92MiniView.d.ts +70 -13
  210. package/types/packages/relation-graph-models/models/RelationGraphWith93Image.d.ts +36 -0
  211. package/types/packages/relation-graph-models/models/RelationGraphWith93Image_codes.d.ts +36 -0
  212. package/types/packages/relation-graph-models/models/RelationGraphWith95Dom.d.ts +108 -0
  213. package/types/packages/relation-graph-models/models/RelationGraphWith99API.d.ts +125 -0
  214. package/types/packages/relation-graph-models/models/RelationGraphWith9EasyView.d.ts +57 -11
  215. package/types/packages/relation-graph-models/utils/RGCanvasImpl2D.d.ts +2 -3
  216. package/types/packages/relation-graph-models/utils/RGCommon.d.ts +6 -1
  217. package/types/packages/relation-graph-models/utils/RGDragUtils.d.ts +14 -11
  218. package/types/packages/relation-graph-models/utils/RGFullscreenUtils.d.ts +1 -1
  219. package/types/packages/relation-graph-models/utils/RGGraphMath.d.ts +27 -0
  220. package/types/packages/relation-graph-models/utils/RGIntergration.d.ts +32 -34
  221. package/types/packages/relation-graph-models/utils/RGNodesAnalytic.d.ts +6 -15
  222. package/types/packages/relation-graph-models/utils/RGTips.d.ts +7 -0
  223. package/types/packages/relation-graph-models/utils/line/RGLinePath.d.ts +16 -1
  224. package/types/packages/relation-graph-models/utils/line/RGLinePathUtils.d.ts +1 -1
  225. package/types/packages/relation-graph-models/utils/line/RGPathGeneratorFor1.d.ts +1 -1
  226. package/types/packages/relation-graph-models/utils/line/RGPathGeneratorFor4.d.ts +1 -1
  227. package/types/packages/relation-graph-models/utils/line/RGPathGeneratorFor44.d.ts +1 -1
  228. package/types/packages/relation-graph-models/utils/line/RGPathGeneratorFor49.d.ts +1 -1
  229. package/types/packages/relation-graph-models/utils/line/RGPathGeneratorFor6.d.ts +1 -1
  230. package/types/packages/relation-graph-models/utils/line/RGPathGeneratorForCurve.d.ts +1 -1
  231. package/types/packages/types.d.ts +1467 -0
  232. package/types/packages/types.ts +1475 -0
  233. package/types/react.d.ts +38 -38
  234. package/types/vue3.d.ts +229 -229
@@ -0,0 +1,1475 @@
1
+ /**
2
+ * relation-graph
3
+ * Website: http://www.relation-graph.com/
4
+ * Github: https://github.com/seeksdream/relation-graph
5
+ */
6
+
7
+ /**
8
+ * Data types used by relation-graph
9
+ * This document will define and introduce the core data types used by the relation-graph component.
10
+ */
11
+
12
+ import {RelationGraphCore} from './relation-graph-models/models/RelationGraphCore';
13
+ import {RGLinePathCommands} from "./relation-graph-models/utils/line/RGLinePath";
14
+ import {RGNetworkAnalyzer} from "./relation-graph-models/RGObjectsForExport";
15
+
16
+
17
+
18
+ /**
19
+ * Relation-graph instance type, the instance object can provide methods for manipulating the graph, such as adding nodes, deleting nodes, updating node properties, etc.
20
+ * @example:
21
+ * ```ts
22
+ * graphInstance.addNodes([
23
+ * {id: 'a', text: 'Node A', x: 100, y: 100},
24
+ * {id: 'b', text: 'Node B', x: 200, y: 200, color: '#ff0000'},
25
+ * ]);
26
+ * graphInstance.removeNodeById('a');
27
+ * graphInstance.updateNode('b', {text: 'Updated Node B', color: '#00ff00'});
28
+ * ```
29
+ */
30
+ export type RelationGraphInstance = RelationGraphCore;
31
+
32
+ /**
33
+ * Internal connect target types for relation-graph
34
+ */
35
+ export enum RGInnerConnectTargetType {
36
+ Node = 'node',
37
+ NodePoint = 'NodePoint',
38
+ HTMLElementId = 'HTMLElementId',
39
+ CanvasPoint = 'CanvasPoint',
40
+ ViewPoint = 'ViewPoint'
41
+ }
42
+
43
+ /**
44
+ * Junction points for connecting lines to nodes
45
+ * You can set the fromJunctionPoint and toJunctionPoint properties of the line to use it:
46
+ * @example
47
+ * ```ts
48
+ * import {RGJunctionPoint} from 'relation-graph-react';
49
+ * const line = {
50
+ * from: 'node1',
51
+ * to: 'node2',
52
+ * fromJunctionPoint: RGJunctionPoint.left, // Set the junction point on the 'from' node
53
+ * toJunctionPoint: RGJunctionPoint.right // Set the junction point on the 'to' node
54
+ * };
55
+ * ```
56
+ */
57
+ export enum RGJunctionPoint {
58
+ border = 'border',
59
+ ltrb = 'ltrb',
60
+ tb = 'tb',
61
+ lr = 'lr',
62
+ left = 'left',
63
+ right = 'right',
64
+ top = 'top',
65
+ bottom = 'bottom'
66
+ }
67
+
68
+ /**
69
+ * Data type used internally by relation-graph to manage connection points
70
+ * @inner This type is used internally by relation-graph and is not recommended for direct use by users
71
+ */
72
+ export type RGConnectTarget4NodePoint = {
73
+ targetId: string;
74
+ targetType: string;
75
+ nodeId?: string;
76
+ junctionPoint: RGJunctionPoint;
77
+ width: number;
78
+ height: number;
79
+ offsetX: number;
80
+ offsetY: number;
81
+ offsetPercentX: number;
82
+ offsetPercentY: number;
83
+ targetData: Record<string, any>;
84
+ };
85
+ /**
86
+ * Resize handle positions for relation-graph
87
+ * @inner
88
+ */
89
+ export type RGResizeHandlePosition = 't' | 'r' | 'b' | 'l' | 'tl' | 'tr' | 'bl' | 'br';
90
+ /**
91
+ * Used to specify the position for relation-graph widgets (such as toolbars, zoom controls, etc.)
92
+ * @example
93
+ * ```ts
94
+ * import { RGSlotOnView, RGEditingNodeController, RGEditingNearNodeWidget } from 'relation-graph-react';
95
+ * <RGSlotOnView>
96
+ * <RGEditingNodeController> // Used to wrap the node editing area controller, it identifies one or more nodes currently being edited
97
+ * <RGEditingNearNodeWidget position="top"> // Used to display custom widgets near the node editing area, here it is placed above the node
98
+ * <button>Custom Top Widget</button> // This is a custom button that will be displayed above the node
99
+ * </RGEditingNearNodeWidget>
100
+ * </RGEditingNodeController>
101
+ * </RGSlotOnView>
102
+ * ```
103
+ *
104
+ */
105
+ export type RGWidgetPosition = 'top' | 'right' | 'bottom' | 'left' | 'tl' | 'tr' | 'bl' | 'br';
106
+ /**
107
+ * @inner
108
+ */
109
+ export type RGLineEditPoint = 'start' | 'end';
110
+
111
+ /**
112
+ * Node shapes supported by default in relation-graph, which affect the connection points of lines to nodes and the rendering of nodes on Canvas 2D (Thumbnails view, EasyView).
113
+ */
114
+ export enum RGNodeShape {
115
+ circle = 0,
116
+ rect = 1
117
+ }
118
+
119
+ /**
120
+ * Line shapes for relation-graph
121
+ * You can set the lineShape property of the line to use it:
122
+ * @example
123
+ * ```ts
124
+ * import {RGLineShape} from 'relation-graph-react';
125
+ * const line = {
126
+ * from: 'node1',
127
+ * to: 'node2',
128
+ * lineShape: RGLineShape.StandardCurve // Set the line shape to StandardCurve
129
+ * };
130
+ * ```
131
+ */
132
+ export enum RGLineShape {
133
+ StandardStraight = 1,
134
+ StandardCurve = 6,
135
+ Curve2 = 2,
136
+ Curve3 = 3,
137
+ Curve5 = 5,
138
+ Curve7 = 7,
139
+ Curve8 = 8,
140
+ SimpleOrthogonal = 4,
141
+ StandardOrthogonal = 44,
142
+ HardOrthogonal = 49
143
+ }
144
+
145
+ /**
146
+ * The type of target object that triggered the event. For example, in a right-click event (onContextmenu), relation-graph will tell you on which type of object the right-click event was triggered.
147
+ * 'canvas' means the event was triggered on the canvas, 'node' means it was triggered on a node, and 'line' means it was triggered on a line.
148
+ */
149
+ export type RGEventTargetType = 'canvas' | 'node' | 'line';
150
+
151
+ /**
152
+ * Direction enum used in internal logic processing of relation-graph
153
+ */
154
+ export enum RGDirection {
155
+ Left = 'left',
156
+ Top = 'top',
157
+ Right = 'right',
158
+ Bottom = 'bottom',
159
+ }
160
+
161
+ /**
162
+ * User event type for relation-graph, can be MouseEvent or TouchEvent
163
+ */
164
+ export type RGUserEvent = MouseEvent | TouchEvent;
165
+ /**
166
+ * Rectangle target type for nodes in relation-graph
167
+ */
168
+ export type RGRectTarget = {
169
+ x: number;
170
+ y: number;
171
+ nodeShape: RGNodeShape;
172
+ el_W: number;
173
+ el_H: number;
174
+ }
175
+ /**
176
+ * Line target type for lines in relation-graph
177
+ */
178
+ export type RGLineTarget = RGRectTarget & {
179
+ id?: string // Like node.text
180
+ text?: string; // Like node.text
181
+ targetType: RGInnerConnectTargetType | string
182
+ targetData?: Record<string, any>
183
+ hidden?: boolean
184
+ };
185
+ /**
186
+ * JSON node type for relation-graph
187
+ * @example
188
+ * ```ts
189
+ * import {JsonNode} from 'relation-graph-react';
190
+ * const node: JsonNode = {
191
+ * id: 'node1',
192
+ * text: 'Node 1',
193
+ * type: 'customNodeType',
194
+ * x: 100,
195
+ * y: 100,
196
+ * color: '#ff0000',
197
+ * nodeShape: RGNodeShape.rect,
198
+ * width: 120,
199
+ * height: 60,
200
+ * data: {
201
+ * customProperty: 'customValue'
202
+ * }
203
+ * };
204
+ * ```
205
+ */
206
+ export type JsonNode = {
207
+ id: string
208
+ text?: string
209
+ type?: string
210
+ targetType?: string
211
+ expanded?: boolean
212
+ selected?: boolean
213
+ disablePointEvent?: boolean
214
+ disableDrag?: boolean
215
+ className?: string
216
+ nodeShape?: RGNodeShape
217
+ borderColor?: string
218
+ borderWidth?: number
219
+ borderRadius?: number
220
+ fontColor?: string
221
+ fontSize?: number
222
+ color?: string
223
+ opacity?: number
224
+ fixed?: boolean
225
+ width?: number
226
+ height?: number
227
+ x?: number
228
+ y?: number
229
+ zIndex?: number
230
+ data?: Record<string, any>
231
+ expandHolderPosition?: string
232
+ force_weight?: number
233
+ el_W?: number;
234
+ el_H?: number;
235
+ /**
236
+ * Will be ignored when importing data
237
+ */
238
+ children?: JsonNode[]
239
+ hidden?: boolean
240
+ alwaysRender?: boolean
241
+ }
242
+ /**
243
+ * Enhanced node type for runtime in relation-graph, it includes additional properties needed for runtime such as whether to render, calculated visibility, layout information, etc.
244
+ */
245
+ export type RGNode = Omit<JsonNode, 'children'> & RGRectTarget & {
246
+ type: string
247
+ x: number
248
+ y: number
249
+ nodeShape: RGNodeShape
250
+ lot: {
251
+ childs: RGNode[]
252
+ parent?: RGNode | undefined
253
+ eached?: boolean
254
+ strength?: number
255
+ subling?: {
256
+ level: number
257
+ all_size: number
258
+ all_strength: number
259
+ }
260
+ level?: number
261
+ index_of_parent?: number
262
+ strength_of_level?: number
263
+ index_of_level?: number
264
+ childrenSize?: number
265
+ childrenSizeVisible?: number
266
+ index_of_p_childs?: number
267
+ strengthWithChilds?: number
268
+ strengthWithChilds_from?: number
269
+ x?: number
270
+ y?: number
271
+ }
272
+ rgChildrenSize?: number
273
+ rgShouldRender?: boolean
274
+ rgCalcedVisibility?: boolean
275
+ }
276
+ /**
277
+ * JSON line type for relation-graph
278
+ * @example
279
+ * ```ts
280
+ * import {JsonLine, RGLineShape} from 'relation-graph-react';
281
+ * const line: JsonLine = {
282
+ * id: 'line1',
283
+ * from: 'node1',
284
+ * to: 'node2',
285
+ * text: 'Line from Node 1 to Node 2',
286
+ * type: 'customLineType',
287
+ * color: '#0000ff',
288
+ * lineShape: RGLineShape.StandardCurve,
289
+ * data: {
290
+ * customProperty: 'customValue'
291
+ * }
292
+ * };
293
+ * ```
294
+ */
295
+ export type JsonLine = {
296
+ id?: string
297
+ from: string
298
+ to: string
299
+ text?: string
300
+ selected?: boolean
301
+ type?: string;
302
+ isFakeLine?: boolean;
303
+ fromType?: string;
304
+ toType?: string;
305
+ color?: string
306
+ fontColor?: string
307
+ fontSize?: number
308
+ lineWidth?: number
309
+ opacity?: number
310
+ lineShape?: RGLineShape
311
+ className?: string
312
+ showStartArrow?: boolean
313
+ showEndArrow?: boolean
314
+ startMarkerId?: string
315
+ endMarkerId?: string
316
+ useTextOnPath?: boolean
317
+ onPathStartOffset?: string
318
+ placeText?: 'start'|'center'|'end'
319
+ textAnchor?: string
320
+ lineDirection?: string
321
+ polyLineStartDistance?: number
322
+ disablePointEvent?: boolean
323
+ data?: Record<string, any>
324
+ cssVars?: Record<string, any>
325
+ force_elastic?: number
326
+ textOffset_x?: number
327
+ textOffset_y?: number
328
+ animation?: number
329
+ dashType?: number
330
+ lineRadius?: number
331
+ forDisplayOnly?: boolean
332
+ junctionOffset?: number
333
+ fromJunctionPoint?: RGJunctionPoint
334
+ toJunctionPoint?: RGJunctionPoint
335
+ fromJuctionPointOffsetX?: number
336
+ fromJuctionPointOffsetY?: number
337
+ toJuctionPointOffsetX?: number
338
+ toJuctionPointOffsetY?: number
339
+ hidden?: boolean
340
+ }
341
+ /**
342
+ * RGFakeLine can use non-node objects as the start or end points of fake nodes, enabling more complex line connection requirements
343
+ * The difference between RGFakeLine and RGLine is that the from and to properties of RGLine must be node IDs, while RGFakeLine is not restricted, but RGFakeLine does not produce any layout effects
344
+ * By setting fromType and toType to identify the start and end types of the fake line
345
+ * The default supported types are those in the RGInnerConnectTargetType enum. You can also define custom types by using the graphInstance.setFakeLineTargetRender method to specify how to obtain the RGRectTarget information for the custom type.
346
+ */
347
+ export type RGFakeLine = JsonLine & {
348
+ id: string;
349
+ fromType: RGInnerConnectTargetType | string;
350
+ toType: RGInnerConnectTargetType | string;
351
+ }
352
+ /**
353
+ * Enhanced line type for runtime in relation-graph
354
+ * isReverse: indicates whether the line direction is reversed, which is automatically calculated based on the from and to nodes and does not need to be set manually.
355
+ */
356
+ export type RGLine = JsonLine & {
357
+ id: string;
358
+ isReverse?: boolean // 自动计算,无需设置
359
+ }
360
+ /**
361
+ * The runtime derived object type of the line, which can associate the line with its start and end nodes, and contains some additional properties for rendering and visibility calculation
362
+ * You can get the RGLink object through the graphInstance.getLinks() method, or get the RGLink object corresponding to the specified line through the graphInstance.getLinkByLineId(lineId: string) method
363
+ * - line : The RGLine object corresponding to this link
364
+ * - fromNode : The RGNode object representing the start node of the line
365
+ * - toNode : The RGNode object representing the end node of the line
366
+ * - totalLinesBetweenNodes : The total number of lines between the fromNode and toNode
367
+ * - currentLineIndex : The index of the current line among all lines between the fromNode and toNode
368
+ * - rgShouldRender : Indicates whether this link should be rendered, which is calculated based on the visibility of the fromNode and toNode, as well as whether the line itself is hidden
369
+ * - rgCalcedVisibility : Indicates whether this link is visible, which is calculated based on the visibility of the fromNode and toNode, as well as whether the line itself is hidden
370
+ *
371
+ */
372
+ export type RGLink = {
373
+ lineId: string
374
+ line: RGLine,
375
+ fromNode: RGNode
376
+ toNode: RGNode
377
+ totalLinesBetweenNodes: number
378
+ currentLineIndex: number
379
+ rgShouldRender?: boolean
380
+ rgCalcedVisibility?: boolean // allLines(!hidden) && (fromNode rgCalcedVisibility) && (toNode rgCalcedVisibility)
381
+ };
382
+ /**
383
+ * @deprecated Use RGLink instead
384
+ */
385
+ export type RGElementLine = RGLink;
386
+ /**
387
+ * RGJsonData is a JSON data format for quickly setting graph data. Through it, you can quickly import data using the graphInstance.setJsonData method.
388
+ * It is a shortcut method, equivalent to the following code:
389
+ * ```ts
390
+ * const jsonData = {
391
+ * rootId: 'rootNodeId',
392
+ * nodes: [...],
393
+ * lines: [...]
394
+ * };
395
+ * graphInstance.addNodes(jsonData.nodes);
396
+ * graphInstance.addLines(jsonData.lines);
397
+ * graphInstance.setRootNodeId(jsonData.rootId);
398
+ * ```
399
+ */
400
+ export type RGJsonData = {
401
+ rootId?: string
402
+ nodes: JsonNode[]
403
+ lines: JsonLine[]
404
+ fakeLines?: RGFakeLine[]
405
+ };
406
+ /**
407
+ * RGGraphData is the internal data structure used by relation-graph to manage graph data
408
+ */
409
+ export type RGGraphData = {
410
+ rootNode?: RGNode,
411
+ nodes: RGNode[],
412
+ normalLines: RGLine[],
413
+ fakeLines: RGFakeLine[]
414
+ };
415
+ /**
416
+ * Coordinate type for relation-graph
417
+ */
418
+ export type RGCoordinate = {
419
+ x: number;
420
+ y: number;
421
+ };
422
+ /**
423
+ * Rectangle box type for counting node areas
424
+ * For example, you can get the rectangular area occupied by the specified nodes through the following code:
425
+ * ```ts
426
+ * const nodesBoxInfo: RGNodesRectBox = graphInstance.getNodesRectBox(someNodes);
427
+ * ```
428
+ */
429
+ export type RGNodesRectBox = {
430
+ width: number;
431
+ height: number;
432
+ minX: number;
433
+ minY: number;
434
+ maxX: number;
435
+ maxY: number;
436
+ };
437
+ /**
438
+ * Position type for relation-graph
439
+ * Generally used to save position coordinates
440
+ */
441
+ export type RGPosition = RGCoordinate;
442
+ /**
443
+ * Drag callback type used in internal logic processing of relation-graph
444
+ * @inner
445
+ */
446
+ export type RGDraggingCallback = (
447
+ offsetX: number,
448
+ offsetY: number,
449
+ startElPosition: { x: number; y: number },
450
+ startEventPosition: { x: number; y: number },
451
+ event: MouseEvent | TouchEvent
452
+ ) => void;
453
+ /**
454
+ * Drag end callback type used in internal logic processing of relation-graph
455
+ * @inner
456
+ */
457
+ export type RGDraggedCallback = (
458
+ buffX: number,
459
+ buffY: number,
460
+ event: MouseEvent | TouchEvent
461
+ ) => void;
462
+ /**
463
+ * Layout options fragment: node alignment settings
464
+ * - alignItemsX: The coordinate assigned to the node is based on which position of the node, 'start' means left-aligned, 'center' means center-aligned, and 'end' means right-aligned
465
+ * - alignItemsY: The coordinate assigned to the node is based on which position of the node, 'start' means top-aligned, 'center' means center-aligned, and 'end' means bottom-aligned
466
+ */
467
+ export type RGLayoutOptions4Alignment = {
468
+ alignItemsX?: 'start' | 'center' | 'end';
469
+ alignItemsY?: 'start' | 'center' | 'end';
470
+ };
471
+ /**
472
+ * Layout core options type
473
+ * - layoutName: Layout algorithm name such as 'force', 'center', 'tree', etc.
474
+ * - layoutDirection: Layout direction, 'h' means horizontal layout, 'v' means vertical layout
475
+ * - fixedRootNode: By default, the root node is fixed at the center of the canvas (coordinates: 0,0). If set to true, the root node position will not be fixed, and the layout engine will assign relative positions to other nodes based on the current coordinates of the root node.
476
+ * - autoLayouting: Used to get whether the layout engine is currently performing automatic layout calculations (applicable to force-directed layouts and center layouts that inherit from force-directed layouts). This property does not need to be set and is read-only.
477
+ * - supportAutoLayout: Whether to support automatic layout. Generally, force-directed layouts and center layouts that inherit from force-directed layouts support automatic layout, while other layouts do not support automatic layout. This property does not need to be set and is read-only.
478
+ */
479
+ export type RGLayoutOptionsCore = RGLayoutOptions4Alignment & {
480
+ layoutName: string;
481
+ layoutDirection?: 'h' | 'v';
482
+ fixedRootNode?: boolean
483
+ autoLayouting?: boolean
484
+ supportAutoLayout?: boolean
485
+ };
486
+ /**
487
+ * Force-directed layout options type
488
+ * - fastStart: Default is false. The force-directed layout will start the force-directed calculation with a center layout as the initial state. If set to true, it will start the force-directed calculation from a random position, which may speed up the convergence of the layout, but the node positions may be more dispersed in the initial state.
489
+ * - maxLayoutTimes: Maximum number of layout iterations, default is 300. The force-directed layout will stop the layout calculation when it reaches this number of iterations, even if the layout has not fully converged.
490
+ * - byNode: Whether to enable repulsion calculation between nodes, default is true.
491
+ * - byLine: Whether to enable elastic force calculation between lines, default is true.
492
+ * - force_node_repulsion: Repulsion coefficient between nodes, default is 1. The larger this value, the stronger the repulsion between nodes, and the more dispersed the layout will be.
493
+ * - force_line_elastic: Elastic coefficient between lines, default is 1. The larger this value, the stronger the elastic force between lines, and the more compact the layout will be.
494
+ *
495
+ */
496
+ export type RGForceLayoutOptions = RGLayoutOptionsCore & {
497
+ fastStart?: boolean;
498
+ maxLayoutTimes?: number;
499
+ byNode?: boolean;
500
+ byLine?: boolean;
501
+ force_node_repulsion?: number;
502
+ force_line_elastic?: number;
503
+ };
504
+ /**
505
+ * Center layout options type
506
+ * - distance_coefficient: Coefficient for calculating the ideal distance between nodes, default is 1. The larger this value, the greater the ideal distance between nodes, and the more dispersed the layout will be.
507
+ * - disableAsForceLayout: CenterLayout extends ForceLayout. If you want to use CenterLayout as a pure center layout without force-directed layout capabilities, you can set this option to true to disable the force-directed layout features.
508
+ * - levelDistance: Array of distances between levels, default is []. You can set the distance between different levels of nodes in the tree structure. For example, [100, 200, 300] means the distance between level 0 and level 1 is 100, the distance between level 1 and level 2 is 200, and the distance between level 2 and level 3 is 300. If the array length is less than the number of levels, the last value will be used for the remaining levels.
509
+ */
510
+ export type RGCenterLayoutOptions = RGForceLayoutOptions & {
511
+ distance_coefficient?: number
512
+ levelDistance?: number[]
513
+ disableAsForceLayout?: boolean;
514
+ };
515
+ /**
516
+ * Tree layout options type
517
+ * - from: The node ID from which the tree layout starts
518
+ * - treeNodeGapH: Horizontal gap between tree nodes, default is 50
519
+ * - treeNodeGapV: Vertical gap between tree nodes, default is 50
520
+ * - levelGaps: Array of gaps between levels, default is []. You can set the gap between different levels of nodes in the tree structure. For example, [100, 200, 300] means the gap between level 0 and level 1 is 100, the gap between level 1 and level 2 is 200, and the gap between level 2 and level 3 is 300. If the array length is less than the number of levels, the last value will be used for the remaining levels.
521
+ * - layoutExpansionDirection: Direction of tree expansion, 'start' means expanding from top to bottom or left to right, 'center' means expanding from center to both sides, 'end' means
522
+ * - simpleTree: By default, the tree will expand bidirectionally based on the root node according to the direction of the relationships. If set to true, the tree structure will only expand unidirectionally.
523
+ * - ignoreNodeSize: Whether to ignore node size when calculating tree layout, default is false. If set to true, all nodes will be treated as having the same size during layout calculation, which may speed up the layout calculation but may affect the layout effect.
524
+ * - alignParentItemsX: Alignment of parent nodes in the X direction, 'start' means left-aligned, 'center' means center-aligned, and 'end' means right-aligned. Default is 'center'.
525
+ * - alignParentItemsY: Alignment of parent nodes in the Y direction, 'start' means top-aligned, 'center' means center-aligned, and 'end' means bottom-aligned. Default is 'center'.
526
+ */
527
+ export type RGTreeLayoutOptions = RGLayoutOptionsCore & {
528
+ from?: string
529
+ treeNodeGapH?: number
530
+ treeNodeGapV?: number
531
+ levelGaps?: number[]
532
+ layoutExpansionDirection?: 'start' | 'center' | 'end'
533
+ simpleTree?: boolean;
534
+ ignoreNodeSize?: boolean;
535
+ alignParentItemsX?: 'start' | 'center' | 'end';
536
+ alignParentItemsY?: 'start' | 'center' | 'end';
537
+ };
538
+ /**
539
+ * Layout options type for relation-graph
540
+ * Supported layoutName include:
541
+ * - tree: Tree layout, using RGTreeLayout class for layout
542
+ * - center: Center layout, using RGCenterLayout class for layout
543
+ * - circle: Circle layout, using RGCircleLayout class for layout
544
+ * - force: Force-directed layout, using RGForceLayout class for layout
545
+ * - fixed: Fixed layout, using RGFixedLayout class for layout
546
+ * - smart-tree: Smart tree layout, using RGSmartTreeLayout class for layout
547
+ * - io-tree: Input-output tree layout, using RGIOTreeLayout class for layout
548
+ * - folder: Folder layout, using RGFolderLayout class for layout
549
+ */
550
+ export type RGLayoutOptions =
551
+ (RGCenterLayoutOptions & { layoutName: 'center' })
552
+ | (RGForceLayoutOptions & { layoutName: 'force' })
553
+ | (RGTreeLayoutOptions & { layoutName: 'tree' })
554
+ | (RGLayoutOptionsCore & { layoutName: 'circle' })
555
+ | (RGLayoutOptionsCore & { layoutName: 'fixed' })
556
+ | (RGTreeLayoutOptions & { layoutName: 'smart-tree' })
557
+ | (RGTreeLayoutOptions & { layoutName: 'io-tree' })
558
+ | (RGTreeLayoutOptions & { layoutName: 'folder' })
559
+
560
+ /**
561
+ * Layout engine interface type for relation-graph internal use
562
+ * @inner
563
+ */
564
+ export interface RGLayout {
565
+ isMainLayouer: boolean
566
+ requireLinks: boolean
567
+ allNodes: RGNode[]
568
+ rootNode?: RGNode
569
+ layoutOptions: RGLayoutOptions
570
+ networkAnalyzer: RGNetworkAnalyzer
571
+ setLinks: (links: RGLink[]) => void
572
+ placeNodes: (allNodes: RGNode[], rootNode: RGNode) => void
573
+ start?: () => void
574
+ stop?: () => void
575
+ }
576
+
577
+ /**
578
+ * Complete configuration type that includes all options available for users to configure
579
+ */
580
+ export type RGOptionsInited = {
581
+ instanceId: string
582
+ debug: boolean
583
+ showToolBar: boolean
584
+ backgroundColor: string
585
+ disableWheelEvent: boolean
586
+ wheelEventAction: 'zoom' | 'scroll' | 'none'
587
+ dragEventAction: 'move' | 'selection' | 'none'
588
+ disableDragNode: boolean
589
+ disableDragLine: boolean
590
+ canvasMoveMode: boolean
591
+ disableNodePointEvent: boolean
592
+ disableLinePointEvent: boolean
593
+ toolBarDirection: string
594
+ toolBarPositionH: string
595
+ toolBarPositionV: string
596
+ defaultExpandHolderPosition: 'hide' | 'left' | 'top' | 'right' | 'bottom'
597
+ defaultNodeColor: string
598
+ defaultNodeBorderColor: string,
599
+ defaultNodeBorderWidth: number,
600
+ defaultNodeBorderRadius: number,
601
+ defaultNodeShape: RGNodeShape,
602
+ defaultNodeWidth?: number
603
+ defaultNodeHeight?: number
604
+ checkedItemBackgroundColor?: string //
605
+ defaultLineTextOffset_x?: number,
606
+ defaultLineTextOffset_y?: number,
607
+ defaultLineColor: string
608
+ defaultLineWidth: number
609
+ defaultLineShape?: RGLineShape
610
+ // defaultShowLineLabel: boolean
611
+ // hideNodeContentByZoom: boolean
612
+ defaultJunctionPoint?: RGJunctionPoint
613
+ defaultLineJunctionOffset: number,
614
+ // placeSingleNode: boolean
615
+ placeOtherNodes: boolean
616
+ defaultLineTextOnPath: boolean
617
+ lineTextMaxLength: number
618
+ multiLineDistance: number
619
+ checkedNodeId: string // private
620
+ checkedLineId: string // private
621
+ draggingNodeId: string // private
622
+ performanceMode: boolean,
623
+ fullscreenElementXPath: string,
624
+ data: any
625
+ viewHeight: string
626
+ defaultLineMarker: {
627
+ markerWidth: number
628
+ markerHeight: number
629
+ refX: number
630
+ refY: number
631
+ viewBox: string
632
+ data: string
633
+ }
634
+ layout: RGLayoutOptions
635
+ canvasZoom: number // private
636
+ mouseWheelSpeed: number // private
637
+ minCanvasZoom: number // private
638
+ maxCanvasZoom: number // private
639
+ placeOtherGroup: boolean
640
+ defaultPolyLineRadius: number,
641
+ reLayoutWhenExpandedOrCollapsed: boolean
642
+ creatingSelection: boolean
643
+ selectionView: RGSelectionView
644
+ creatingNodePlot: boolean
645
+ showTemplateNode: boolean
646
+ newNodeTemplate: any
647
+ creatingLinePlot: boolean
648
+ newLineTemplate: RGLine
649
+ newLinkTemplate: any
650
+ definitelyNoDataProviderNeeded: boolean
651
+ }
652
+ /**
653
+ * Complete configuration type that includes all runtime state options, none of which can be directly configured by users
654
+ */
655
+ export type RGOptionsFull = RGOptionsInited & {
656
+ snapshotting: boolean
657
+ graphLoading: boolean
658
+ enableNodeXYAnimation: boolean
659
+ enableCanvasTransformAnimation: boolean
660
+ graphLoadingText: string
661
+ editingLineController: RGEditingLine,
662
+ editingController: RGEditingNodes,
663
+ nodeConnectController: RGConnectingNode,
664
+ showReferenceLine: boolean,
665
+ referenceLineAdsorption: boolean,
666
+ editingReferenceLine: {
667
+ show: boolean,
668
+ directionV: boolean,
669
+ directionH: boolean,
670
+ v_x: number,
671
+ v_y: number,
672
+ v_height: number,
673
+ h_x: number,
674
+ h_y: number,
675
+ h_width: number
676
+ },
677
+ showMiniView: boolean,
678
+ miniViewVisibleHandle: {
679
+ x: number,
680
+ y: number,
681
+ width: number,
682
+ height: number,
683
+ emptyContent: boolean
684
+ }
685
+ instanceId: string
686
+ viewSize: { width: number; height: number }
687
+ canvasSize: {
688
+ width: number
689
+ height: number
690
+ }
691
+ canvasOffset: {
692
+ x: number
693
+ y: number
694
+ }
695
+ fullscreen: boolean // private
696
+ showEasyView?: boolean // private
697
+ canvasOpacity?: number // private
698
+ }
699
+ /**
700
+ * Partial configuration type for relation-graph, users can configure any subset of options
701
+ */
702
+ export type RGOptions = Partial<RGOptionsInited>;
703
+ /**
704
+ * When the user performs a selection operation on the canvas (event: onCanvasSelectionEnd), the type of selection view information passed
705
+ */
706
+ export type RGSelectionView = {
707
+ x: number
708
+ y: number
709
+ width: number
710
+ height: number
711
+ };
712
+
713
+ /**
714
+ * Event handler type for relation-graph events
715
+ * @inner
716
+ */
717
+ export type RGEventHandler = (eventName: RGEventNames, ...args: any[]) => void | any;
718
+ /**
719
+ * Event emit hook type for relation-graph events
720
+ * @inner
721
+ */
722
+ export type RGEventEmitHook = (eventName: RGEventNames, ...args: any[]) => void | any;
723
+ /**
724
+ * Control point type for RGLineShape.Line44 lines
725
+ * @inner
726
+ */
727
+ export type RGCtrlPointForLine44 = {
728
+ pIndex: number,
729
+ optionName: string,
730
+ direction: 'v' | 'h',
731
+ x: number,
732
+ y: number,
733
+ startDirection: RGDirection,
734
+ endDirection: RGDirection,
735
+ hide?: boolean
736
+ }
737
+
738
+ /**
739
+ * The exposed interface type of the relation-graph component instance
740
+ * @inner
741
+ */
742
+ export interface RelationGraphExpose {
743
+ getInstance(): RelationGraphInstance;
744
+ }
745
+
746
+ /**
747
+ * Props type for RGNodeSlot component
748
+ */
749
+ export interface RGNodeSlotProps {
750
+ node: RGNode
751
+ defaultExpandHolderPosition?: string
752
+ dragging?: boolean
753
+ checked?: boolean
754
+ }
755
+
756
+ /**
757
+ * Props type for RGLineSlot component
758
+ * @inner
759
+ */
760
+ export interface RGLinePeelProps {
761
+ line: RGLine | RGFakeLine
762
+ checked?: boolean
763
+ defaultLineTextOnPath?: boolean
764
+ graphInstanceId?: string
765
+ }
766
+
767
+ /**
768
+ * Custom line slot component Props type
769
+ * @param lineConfig Configuration parameters for the line, which include information such as the start and end objects, line objects, etc., used for line objects, and global default configurations for rendering lines.
770
+ * @param checked Whether the current line is selected
771
+ * @param defaultLineTextOnPath Whether the line uses textPath to typeset text, allowing the text to be arranged along the line path
772
+ * @param graphInstanceId The ID of the current graph instance, used for creating some unique identifiers, etc. (for example, you can display two relation-graph components with the same data on one page to prevent their ids from conflicting)
773
+ *
774
+ */
775
+ export interface RGLineSlotProps {
776
+ lineConfig: RGGenerateLineConfig
777
+ checked?: boolean
778
+ defaultLineTextOnPath?: boolean
779
+ graphInstanceId?: string
780
+ }
781
+
782
+ /**
783
+ * Props type for RGLinePath component
784
+ * @param lineConfig Configuration parameters for the line, which include information such as the start and end objects, line objects, etc., used for line objects, and global default configurations for rendering lines.
785
+ * @param linePathInfo The path information of the line, including path data, text position, etc., used for rendering the line path
786
+ * @param defaultLineTextOnPath Whether the line uses textPath to typeset text, allowing the text to be arranged along the line path
787
+ * @param checked Whether the current line is selected
788
+ * @param graphInstanceId The ID of the current graph instance, used for creating some unique identifiers, etc. (for example, you can display two relation-graph components with the same data on one page to prevent their ids from conflicting)
789
+ *
790
+ */
791
+ export interface RGLinePathProps {
792
+ lineConfig: RGGenerateLineConfig
793
+ linePathInfo: RGLinePathInfo
794
+ useTextOnPath?: boolean
795
+ checked?: boolean
796
+ graphInstanceId?: string
797
+ }
798
+
799
+ /**
800
+ * Props type for RGLineText component
801
+ * @param lineConfig Configuration parameters for the line, which include information such as the start and end objects, line objects, etc., used for line objects, and global default configurations for rendering lines.
802
+ * @param linePathInfo The path information of the line, including path data, text position, etc., used for rendering the line path
803
+ * @param checked Whether the current line is selected
804
+ *
805
+ */
806
+ export interface RGLineTextProps {
807
+ lineConfig: RGGenerateLineConfig
808
+ linePathInfo: RGLinePathInfo
809
+ checked?: boolean
810
+ }
811
+
812
+ /**
813
+ * Props type for <RelationGraph /> component
814
+ * @param options Configuration options for relation-graph
815
+ * @param relationGraphCore The core class of relation-graph, default is RelationGraphCore
816
+ */
817
+ export type RelationGraphProps = RGListeners & {
818
+ options: RGOptions;
819
+ relationGraphCore?: new (...args: any[]) => RelationGraphCore;
820
+ };
821
+
822
+ /**
823
+ * Positioning props for <RGToolBar /> components
824
+ * @param direction 'v' means vertical toolbar, 'h' means horizontal toolbar
825
+ * @param positionH 'left' means left-aligned, 'center' means center-aligned, 'right' means right-aligned
826
+ * @param positionV 'top' means top-aligned, 'center' means center-aligned, 'bottom' means bottom-aligned
827
+ */
828
+ export interface RGToolBarProps {
829
+ direction?: 'v' | 'h' | string,
830
+ positionH?: 'left' | 'center' | 'right' | string,
831
+ positionV?: 'top' | 'center' | 'bottom' | string,
832
+ }
833
+
834
+ /**
835
+ * Positioning props for <RGMiniView /> components
836
+ * @param position Position of the mini view: 'tl' | 'tr' | 'bl' | 'br' | 'top' | 'right' | 'bottom' | 'left'
837
+ * @param width Width of the mini view
838
+ * @param height Height of the mini view
839
+ */
840
+ export interface RGMiniViewProps {
841
+ position?: RGWidgetPosition,
842
+ width?: string,
843
+ height?: string,
844
+ className?: string;
845
+ style?: Record<string, string | number | undefined>,
846
+ }
847
+
848
+ /**
849
+ * Positioning props for <RGEditingNearNodeWidget /> components
850
+ * @param position Position of the widget: 'tl' | 'tr' | 'bl' | 'br' | 'top' | 'right' | 'bottom' | 'left'
851
+ */
852
+ export interface RGWidgetProps {
853
+ position?: RGWidgetPosition
854
+ }
855
+
856
+ /**
857
+ * Props type for RGEditingLineController component
858
+ * @inner
859
+ */
860
+ export interface RGEditingLineControllerProps {
861
+ textEditable?: boolean
862
+ onMoveLineVertexStart?: (type: RGLineEditPoint, line: RGLine) => void
863
+ onMoveLineVertexEnd?: RGLineVertexBeDroppedEventHandler
864
+ onLinePathChanged?: (line: RGLine, params: any) => void
865
+ onLineTextDragEnd?: (line: RGLine) => void
866
+ onLineTextChanged?: (line: RGLine) => void
867
+ }
868
+
869
+ /**
870
+ * @inner
871
+ */
872
+ export type RGLineConnectEventHandler = (fromNode: RGNode | RGLineTarget | RGPosition, toNode: RGNode | RGLineTarget | RGPosition, newLineJson?: JsonLine) => void;
873
+ /**
874
+ * @inner
875
+ */
876
+ export type RGLineVertexBeDroppedEventHandler = (fromNode: RGNode | RGLineTarget | RGPosition, toNode: RGNode | RGLineTarget | RGPosition, newLineJson?: JsonLine) => void;
877
+ export type JsonNodeLike = Partial<JsonNode>;
878
+ export type JsonLineLike = Partial<JsonLine>;
879
+ export type JsonNodeTemplate = JsonNodeLike;
880
+ export type JsonLineTemplate = JsonLineLike;
881
+
882
+ /**
883
+ * @inner
884
+ */
885
+ export type CreatingLinePlotOptions = {
886
+ onCreateLine: RGLineConnectEventHandler | undefined
887
+ isReverse?: boolean,
888
+ template?: JsonLineLike
889
+ fromNode?: RGLineTarget
890
+ };
891
+ /**
892
+ * @inner
893
+ */
894
+ export type CreatingNodePlotOptions = {
895
+ templateNode: JsonNodeLike
896
+ templateMove?: (x: number, y: number) => void
897
+ onCreateNode: (x: number, y: number, nodeTemplate?: JsonNodeLike) => void
898
+ };
899
+
900
+ /**
901
+ * Props type for <RGConnectSource> component
902
+ * The RGConnectSource component allows any element to have the functionality of a connection starting point.
903
+ * @param lineTemplate The template information for the connection line, which can be partial properties of JsonLine
904
+ * @param onConnectStart Callback function triggered when starting to initiate a connection line
905
+ * @param onConnectEnd Callback function triggered when the connection line initiation ends
906
+ * @param className Custom class name for the component
907
+ * @param style Custom styles for the component
908
+ * @example
909
+ * ```tsx
910
+ * import {RGLineShape} from 'relation-graph-react';
911
+ *
912
+ * <RGConnectSource
913
+ * :lineTemplate="{ color: 'red', lineShape: RGLineShape.StandardCurve }"
914
+ * :onConnectEnd="(fromNode, toNode, newLineJson) => {
915
+ * console.log('Connection ended:', fromNode, toNode, newLineJson);
916
+ * // You can add the new line to the graph here
917
+ * graphInstance.addLines([newLineJson]);
918
+ * }"
919
+ * >
920
+ * <div class="my-connect-source">
921
+ * Drag from here to connect
922
+ * </div>
923
+ * </RGConnectSource>
924
+ * ```
925
+ */
926
+ export interface RGConnectSourceProps {
927
+ lineTemplate: JsonLineLike;
928
+ onConnectStart?: (newLineTemplate?: JsonLineLike, event?: RGUserEvent) => void;
929
+ onConnectEnd?: RGLineConnectEventHandler; // default is true
930
+ className?: string;
931
+ style?: Record<string, string | number | undefined>,
932
+ }
933
+
934
+ /**
935
+ * Component <RGConnectTarget> Props type
936
+ * The RGConnectTarget component allows any element to have the functionality of a connection endpoint. Unlike RGConnectSource, RGConnectTarget can not only be dragged to start creating a line, but also be used as a connection point for lines.
937
+ * When a connection line is initiated from RGConnectTarget and completed, the new line information can be obtained through the onLineBeCreated event of the <RelationGraph> component and added to the graph. The creation of the line can also be completed through onDragConnectEnd.
938
+ * @param junctionPoint Specifies the junction point information of the connection target
939
+ * @param targetId The target ID corresponding to the connection target, which can be a node ID or a special identifier
940
+ * @param targetType The type of the connection target, which can be customized to distinguish different types of targets, Default is RGInnerConnectTargetType.NodePoint (if RGConnectTarget is placed inside a node) or RGInnerConnectTargetType.CanvasPoint
941
+ * @param targetData Additional data for the connection target, which can store any information related to the target
942
+ * @param onLineVertexBeDropped Callback function triggered when a line endpoint is dragged to this connection target and released
943
+ * @param lineTemplate The template information for the connection line, which can be partial properties of JsonLine
944
+ * @param disableDrop Whether to disable the function of dragging the line endpoint to this connection target for connection, default is false
945
+ * @param disableDrag Whether to disable the function of initiating line connection from this connection target, default is false
946
+ * @param onDragConnectStart Callback function triggered when starting to drag from this connection target to initiate a connection line
947
+ * @param onDragConnectEnd Callback function triggered when the connection line initiated by dragging from this connection target is released
948
+ * @param className Custom class name for the component
949
+ * @param style Custom styles for the component
950
+ * @example
951
+ * ```tsx
952
+ * import {RGJunctionPoint, RGLineShape} from 'relation-graph-react';
953
+ *
954
+ * <RGConnectTarget
955
+ * :junctionPoint="RGJunctionPoint.Bottom"
956
+ * targetId="my-target-1"
957
+ * :targetData="{ info: 'additional data' }"
958
+ * :lineTemplate="{ color: '#ff0000', lineShape: RGLineShape.StandardStraight, data: { info: 'additional data' } }"
959
+ * >
960
+ * <div class="my-connect-target">
961
+ * Drop line here or drag from here to connect
962
+ * </div>
963
+ * </RGConnectTarget>
964
+ * ```
965
+ */
966
+ export interface RGConnectTargetProps {
967
+ junctionPoint: RGJunctionPoint;
968
+ targetId: string;
969
+ targetType?: string;
970
+ targetData?: Record<string, any>;
971
+ onLineVertexBeDropped?: RGLineVertexBeDroppedEventHandler;
972
+ lineTemplate?: JsonLineLike;
973
+ disableDrop?: boolean;
974
+ disableDrag?: boolean;
975
+ onDragConnectStart?: (newLineTemplate?: JsonLineLike, event?: RGUserEvent) => void;
976
+ onDragConnectEnd?: RGLineConnectEventHandler; // default is true
977
+ className?: string;
978
+ style?: Record<string, string | number | undefined>,
979
+ }
980
+
981
+ /**
982
+ * The <RGWatermark /> component is now deprecated. It is recommended to use a custom background component to achieve watermark effects, as custom background components can provide more flexible watermark effects.
983
+ * @deprecated
984
+ */
985
+ export interface RGWatermarkProps {
986
+ forImage?: boolean,
987
+ forDisplay?: boolean,
988
+ position?: RGWidgetPosition,
989
+ width?: string,
990
+ height?: string
991
+ }
992
+
993
+ /**
994
+ * The <RGBackground /> component is now deprecated. It is recommended to use a custom background component to achieve watermark effects, as custom background components can provide more flexible background effects.
995
+ * @deprecated
996
+ */
997
+ export interface RGBackgroundProps {
998
+ forImage?: boolean,
999
+ forDisplay?: boolean,
1000
+ }
1001
+
1002
+ /**
1003
+ * @inner
1004
+ */
1005
+ export type RGLineTextPosition = {
1006
+ x: number;
1007
+ y: number;
1008
+ rotate: number;
1009
+ };
1010
+ /**
1011
+ * Configuration parameter type passed in when generating line path and rendering information
1012
+ * @param line The line object or fake line object
1013
+ * @param from The starting object of the line
1014
+ * @param to The ending object of the line
1015
+ * @param totalLinesBetweenNodes Total number of lines between the two nodes (including this line)
1016
+ * @param currentLineIndex The index of the current line among the lines between the two nodes (starting from 0)
1017
+ * @param defaultOptions Global default configuration options for rendering lines
1018
+ */
1019
+ export type RGGenerateLineConfig = {
1020
+ line: RGLine | RGFakeLine,
1021
+ from?: RGLineTarget,
1022
+ to?: RGLineTarget,
1023
+ totalLinesBetweenNodes?: number,
1024
+ currentLineIndex?: number,
1025
+ defaultOptions?: any
1026
+ }
1027
+ /**
1028
+ * English: Callback function type for generating fake line target objects when rendering custom lines
1029
+ * @param targetType When the value is 'node', it represents a normal node; 'RGInnerConnectTargetType.NodePoint' represents a connection point inside a node; 'RGInnerConnectTargetType.CanvasPoint' represents a connection point on the canvas. Generally, these built-in node types will be automatically handled, and the node types that can be handled by RGFakeLineTargetRender are all user-defined types.
1030
+ * @param targetId The id of the connectable object (e.g., node id, RGConnectTarget's targetId)
1031
+ * @param fakeLine The fake line object
1032
+ * @returns Returns the corresponding line target object
1033
+ *
1034
+ */
1035
+ export type RGFakeLineTargetRender = (targetType: string, targetId: string, fakeLine: RGFakeLine) => RGLineTarget;
1036
+ /**
1037
+ * @inner
1038
+ */
1039
+ export type RGGenerateLinePrams = {
1040
+ line: RGLine,
1041
+ totalLinesBetweenNodes: number,
1042
+ currentLineIndex: number,
1043
+ lineDirection: 'v' | 'h',
1044
+ lineShape: RGLineShape,
1045
+ lineRadius: number,
1046
+ fromJunctionPoint: RGJunctionPoint,
1047
+ toJunctionPoint: RGJunctionPoint,
1048
+ fx: number,
1049
+ fy: number,
1050
+ fcx: number,
1051
+ fcy: number,
1052
+ f_W: number,
1053
+ f_H: number,
1054
+ tx: number,
1055
+ ty: number,
1056
+ tcx: number,
1057
+ tcy: number,
1058
+ t_W: number,
1059
+ t_H: number
1060
+ }
1061
+ /**
1062
+ * Line path information generated by relation-graph
1063
+ * @param pathData SVG Path data of the line
1064
+ * @param pathCommands Command point information of the line path
1065
+ * @param textPosition Position and rotation information of the line text
1066
+ * @param points Array of key point coordinates on the line path
1067
+ * @param startDirection Line start direction (only valid for certain line shapes)
1068
+ * @param endDirection Line end direction (only valid for certain line shapes)
1069
+ */
1070
+ export type RGLinePathInfo = {
1071
+ pathData: string;
1072
+ pathCommands: RGLinePathCommands;
1073
+ textPosition: RGLineTextPosition,
1074
+ points: RGCoordinate[],
1075
+ startDirection?: RGDirection,
1076
+ endDirection?: RGDirection,
1077
+ };
1078
+ /**
1079
+ * @inner
1080
+ */
1081
+ export type CalcNode = {
1082
+ rgNode: RGNode;
1083
+ x: number;
1084
+ y: number;
1085
+ width: number;
1086
+ height: number;
1087
+ };
1088
+ /**
1089
+ * @inner
1090
+ */
1091
+ export type WriteableData<T> = {
1092
+ set(this: void, value: T): void;
1093
+ // value(): T;
1094
+ // /**
1095
+ // * Update value using callback and inform subscribers.
1096
+ // * @param updater callback
1097
+ // */
1098
+ // update(this: void, updater: (v: T) => T): void;
1099
+ }
1100
+ /**
1101
+ * @inner
1102
+ */
1103
+ export type ReactiveDataStores = {
1104
+ store4Options: WriteableData<RGOptionsFull>,
1105
+ store4ShouldRenderNodes: WriteableData<RGNode[]>,
1106
+ store4ShouldRenderLines: WriteableData<RGLine[]>,
1107
+ store4ShouldRenderFakeLines: WriteableData<RGFakeLine[]>,
1108
+ optionsRef?: any, // Store Vue reactive data
1109
+ shouldRenderNodesRef?: any, // Store Vue reactive data
1110
+ shouldRenderLinesRef?: any, // Store Vue reactive data
1111
+ shouldRenderFakeLinesRef?: any // Store Vue reactive data
1112
+ }
1113
+ /**
1114
+ * @inner
1115
+ */
1116
+ export type ReactiveDataUpdaters = {
1117
+ updateStore4Options: (newValue: RGOptionsFull) => void,
1118
+ updateStore4ShouldRenderNodes: (newValue: RGNode[]) => void,
1119
+ updateStore4ShouldRenderLines: (newValue: RGLine[]) => void,
1120
+ updateStore4FakeLines: (newValue: RGFakeLine[]) => void,
1121
+ }
1122
+ /**
1123
+ * Reactive data object returned by hooks provided by the relation-graph component:
1124
+ * - information about the line being created (the line being dragged into the canvas)
1125
+ * @param creating Whether a line is being created
1126
+ * @param fromTarget The starting target of the line being created
1127
+ * @param toTarget The ending target of the line being created
1128
+ * @param lineJson The JsonLine information of the line being created
1129
+ */
1130
+ export type RGCreatingLine = {
1131
+ creating: true,
1132
+ fromTarget?: RGLineTarget,
1133
+ toTarget?: RGLineTarget,
1134
+ lineJson?: JsonLine
1135
+ } | {
1136
+ creating: false
1137
+ }
1138
+
1139
+ /**
1140
+ * Reactive data object returned by hooks provided by the relation-graph component:
1141
+ * - information about the node being created (the node being dragged into the canvas)
1142
+ * @param creating Whether a node is being created
1143
+ * @param nodeJson The JsonNode information of the node being created
1144
+ */
1145
+ export type RGCreatingNode = {
1146
+ creating: true,
1147
+ nodeJson?: JsonNode
1148
+ } | {
1149
+ creating: false
1150
+ }
1151
+ /**
1152
+ * Reactive data object returned by hooks provided by the relation-graph component:
1153
+ * - information about the nodes being edited
1154
+ * @param show Whether nodes are currently being edited. If there are nodes being edited, it is true; otherwise, it is false. When true, the <RGEditingNodeController /> component will be displayed.
1155
+ * @param nodes The array of nodes being edited
1156
+ * @param x The X position of the editing box
1157
+ * @param y The Y position of the editing box
1158
+ * @param width The width of the editing box
1159
+ * @param height The height of the editing box
1160
+ */
1161
+ export type RGEditingNodes = {
1162
+ show: boolean,
1163
+ nodes: RGNode[],
1164
+ x: number,
1165
+ y: number,
1166
+ width: number,
1167
+ height: number
1168
+ }
1169
+ /**
1170
+ * Reactive data object returned by hooks provided by the relation-graph component:
1171
+ * - Information about the node being connected when creating a line
1172
+ * @param x The X position of the connecting box
1173
+ * @param y The Y position of the connecting box
1174
+ * @param width The width of the connecting box
1175
+ * @param height The height of the connecting box
1176
+ */
1177
+ export type RGConnectingNode = {
1178
+ show: boolean,
1179
+ node: RGNode | RGLineTarget | RGRectTarget,
1180
+ x: number,
1181
+ y: number,
1182
+ width: number,
1183
+ height: number
1184
+ }
1185
+ /**
1186
+ * Reactive data object returned by hooks provided by the relation-graph component:
1187
+ * - Information about the line being edited
1188
+ * @param show Whether a line is currently being edited. If there is a line being edited, it is true; otherwise, it is false. When true, the <RGEditingLineController /> component will be displayed.
1189
+ * @param line The line being edited
1190
+ * @param startPoint The starting point of the line being edited
1191
+ * @param endPoint The ending point of the line being edited
1192
+ */
1193
+ export type RGEditingLine = {
1194
+ show: boolean,
1195
+ line: RGLine | null,
1196
+ startPoint: RGPosition,
1197
+ endPoint: RGPosition,
1198
+ text: {
1199
+ show: boolean,
1200
+ x: number,
1201
+ y: number,
1202
+ width: number,
1203
+ height: number
1204
+ },
1205
+ ctrlPoints: RGPosition[],
1206
+ selectedLines: string[],
1207
+ line44Splits: RGCtrlPointForLine44[],
1208
+ line49Points: RGPosition[],
1209
+ ctrlPoint1: RGPosition,
1210
+ ctrlPoint2: RGPosition,
1211
+ toolbar: RGPosition
1212
+ }
1213
+ /**
1214
+ * Reactive data object returned by hooks provided by the relation-graph component:
1215
+ * - Current view information
1216
+ * @param viewSize The size of the view area
1217
+ * @param fullscreen Whether it is in fullscreen mode
1218
+ * @param canvasSize The size of the canvas
1219
+ * @param canvasZoom The zoom level of the canvas
1220
+ * @param canvasOffset The offset position of the canvas
1221
+ */
1222
+ export type RGViewInformation = {
1223
+ viewSize: { width: number; height: number },
1224
+ fullscreen: boolean,
1225
+ canvasSize: { width: number; height: number },
1226
+ canvasZoom: number,
1227
+ canvasOffset: { x: number; y: number },
1228
+ showEasyView?: boolean,
1229
+ }
1230
+ /**
1231
+ * Reactive data object returned by hooks provided by the relation-graph component:
1232
+ * - Information about the currently selected node or lines
1233
+ * @param checkedLineId The ID of the selected line
1234
+ * @param checkedNodeId The ID of the selected node
1235
+ * @param draggingNodeId The ID of the node being dragged
1236
+ */
1237
+ export type RGCheckedItem = {
1238
+ checkedLineId?: string;
1239
+ checkedNodeId?: string;
1240
+ draggingNodeId?: string;
1241
+ }
1242
+
1243
+ /**
1244
+ * Enumeration of all event names supported by relation-graph
1245
+ */
1246
+ export enum RGEventNames {
1247
+ onReady = 'onReady',
1248
+ onNodeClick = 'onNodeClick',
1249
+ onNodeExpand = 'onNodeExpand',
1250
+ onNodeCollapse = 'onNodeCollapse',
1251
+ onLineClick = 'onLineClick',
1252
+ onNodeDragStart = 'onNodeDragStart',
1253
+ onNodeDragEnd = 'onNodeDragEnd',
1254
+ onNodeDragging = 'onNodeDragging',
1255
+ onCanvasDragEnd = 'onCanvasDragEnd',
1256
+ onCanvasDragging = 'onCanvasDragging',
1257
+ onContextmenu = 'onContextmenu',
1258
+ onFullscreen = 'onFullscreen',
1259
+ onCanvasClick = 'onCanvasClick',
1260
+ onCanvasSelectionEnd = 'onCanvasSelectionEnd',
1261
+ beforeZoomStart = 'beforeZoomStart',
1262
+ onZoomEnd = 'onZoomEnd',
1263
+ onViewResize = 'onViewResize',
1264
+ onResizeStart = 'onResizeStart',
1265
+ beforeNodeResize = 'beforeNodeResize',
1266
+ onResizeEnd = 'onResizeEnd',
1267
+ onLineVertexDropped = 'onLineVertexDropped',
1268
+ beforeCreateLine = 'beforeCreateLine',
1269
+ onLineBeCreated = 'onLineBeCreated',
1270
+ beforeAddNodes = 'beforeAddNodes',
1271
+ beforeAddLines = 'beforeAddLines',
1272
+ onKeyboardDown = 'onKeyboardDown',
1273
+ onKeyboardUp = 'onKeyboardUp',
1274
+ onCanvasDragStart = 'onCanvasDragStart',
1275
+ onForceLayoutFinish = 'onForceLayoutFinish',
1276
+ beforeScrollStart = 'beforeScrollStart'
1277
+ }
1278
+ /**
1279
+ * All event listener types supported by the relation-graph component
1280
+ */
1281
+ export interface RGListeners {
1282
+ /**
1283
+ * When the graph is ready, this event is triggered
1284
+ * @param graphInstance The relation-graph instance object
1285
+ */
1286
+ onReady?: (graphInstance: RelationGraphInstance) => void;
1287
+ /**
1288
+ * Triggered when a node is clicked
1289
+ */
1290
+ onNodeClick?: (node: RGNode, e: RGUserEvent) => boolean | void | Promise<boolean | void>;
1291
+ /**
1292
+ * Triggered when a node is expanded
1293
+ */
1294
+ onNodeExpand?: (node: RGNode, e: RGUserEvent) => boolean | void | Promise<boolean | void>;
1295
+ /**
1296
+ * Triggered when a node is collapsed
1297
+ */
1298
+ onNodeCollapse?: (node: RGNode, e: RGUserEvent) => boolean | void | Promise<boolean | void>;
1299
+ /**
1300
+ * Triggered when a line is clicked, line is the line, link is the RGLink object corresponding to the line
1301
+ */
1302
+ onLineClick?: (line: RGLine, link: RGLink, e: RGUserEvent) => boolean | void | Promise<boolean | void>;
1303
+ /**
1304
+ * Triggered when a node drag starts
1305
+ * @param node The dragged node
1306
+ */
1307
+ onNodeDragStart?: (node: RGNode, e: RGUserEvent) => void;
1308
+ /**
1309
+ * Triggered when a node drag ends
1310
+ * @param node The dragged node
1311
+ * @param e The event that triggered the drag end
1312
+ * @param x_buff The x offset at the end of the drag
1313
+ * @param y_buff The y offset at the end of the drag
1314
+ *
1315
+ */
1316
+ onNodeDragEnd?: (node: RGNode, e: RGUserEvent, x_buff: number, y_buff: number) => void;
1317
+ /**
1318
+ * Triggered when a node is being dragged
1319
+ * @param node The dragged node
1320
+ * @param newX The new X position of the node
1321
+ * @param newY The new Y position of the node
1322
+ * @param buffX The X offset of the node from the start of the drag to the current position
1323
+ * @param buffY The Y offset of the node from the start of the drag to the current position
1324
+ * @return Can return void, or can return an RGPosition object, indicating that the x and y in the returned RGPosition object are used as the new position of the node
1325
+ */
1326
+ onNodeDragging?: (node: RGNode, newX: number, newY: number, buffX: number, buffY: number, e: RGUserEvent) => void | RGPosition | undefined;
1327
+ /**
1328
+ * Triggered when the canvas drag ends
1329
+ */
1330
+ onCanvasDragEnd?: (e: RGUserEvent) => void;
1331
+ /**
1332
+ * Triggered when the canvas is being dragged
1333
+ * @param newX The new offset X of the canvas
1334
+ * @param newY The new offset Y of the canvas
1335
+ * @param buffX The X offset of the canvas from the start of the drag to the current position
1336
+ * @param buffY The Y offset of the canvas from the start of the drag to the current position
1337
+ * @return Can return void, or can return an RGPosition object, indicating that the x and y in the returned RGPosition object are used as the new offset position of the canvas
1338
+ */
1339
+ onCanvasDragging?: (newX: number, newY: number, buffX: number, buffY: number) => void | RGPosition | undefined;
1340
+ /**
1341
+ * Triggered when the canvas is right-clicked
1342
+ * @param e The event that triggered
1343
+ * @param objectType The type of object, which can be 'canvas', 'node', or 'line'
1344
+ * @param object The clicked object, which can be undefined, RGNode, or RGLine
1345
+ * @param eventPositionOnCanvas The coordinates of the event on the canvas
1346
+ * @param eventPositionOnView The coordinates of the event on the view (relative to the top-left corner of the <RelationGraph> component)
1347
+ */
1348
+ onContextmenu?: (e: RGUserEvent, objectType: RGEventTargetType, object: RGNode | RGLine | undefined, eventPositionOnCanvas: RGCoordinate, eventPositionOnView: RGCoordinate) => void;
1349
+ /**
1350
+ * Triggered when the fullscreen state changes
1351
+ * @param newValue The new fullscreen state
1352
+ * @param defaultFullscreen The function to perform the default fullscreen toggle operation
1353
+ */
1354
+ onFullscreen?: (newValue: boolean, defaultFullscreen: () => Promise<void>) => void;
1355
+ /**
1356
+ * Triggered when the canvas is clicked
1357
+ * - This event will not be triggered when clicking on nodes or lines
1358
+ */
1359
+ onCanvasClick?: (e: RGUserEvent) => void;
1360
+ /**
1361
+ * Triggered when the canvas selection ends
1362
+ * @param selectionView The area information of the canvas selection, including x, y, width, height
1363
+ */
1364
+ onCanvasSelectionEnd?: (selectionView: RGSelectionView, e: RGUserEvent) => void;
1365
+ /**
1366
+ * Triggered before zooming starts
1367
+ * @return Returning false can prevent the zoom operation
1368
+ */
1369
+ beforeZoomStart?: () => void | false;
1370
+ /**
1371
+ * Triggered when zooming ends
1372
+ */
1373
+ onZoomEnd?: () => void;
1374
+ /**
1375
+ * Triggered when the view size changes
1376
+ */
1377
+ onViewResize?: () => void;
1378
+ /**
1379
+ * Triggered when one or more nodes (via RGEditingResize) start being resized
1380
+ * @param nodes The array of nodes being resized
1381
+ */
1382
+ onResizeStart?: (nodes: RGNode[], e: RGUserEvent) => void;
1383
+ /**
1384
+ * Triggered before resizing a node, returning false can prevent the resize operation
1385
+ * @param node The node being resized
1386
+ * @param newX The new X position to be resized to
1387
+ * @param newY The new Y position to be resized to
1388
+ * @param newW The new width to be resized to
1389
+ * @param newH The new height to be resized to
1390
+ * @return Return false to prevent resizing
1391
+ */
1392
+ beforeNodeResize?: (node: RGNode, newX: number, newY: number, newW: number, newH: number) => void | false;
1393
+ /**
1394
+ * Triggered when one or more nodes (via RGEditingResize) finish being resized
1395
+ * @param nodes The array of nodes that were resized
1396
+ * @param buffX The X offset at the end of the resize
1397
+ * @param buffY The Y offset at the end of the resize
1398
+ */
1399
+ onResizeEnd?: (nodes: RGNode[], buffX: number, buffY: number, e: RGUserEvent) => void;
1400
+ /**
1401
+ * Triggered when the endpoint (start or end) of a line is dropped
1402
+ * @param fromNode The starting node
1403
+ * @param toNode The target node
1404
+ * @param lineTemplate The line information (JsonLine)
1405
+ *
1406
+ */
1407
+ onLineVertexDropped?: (lineInfo: {
1408
+ newLineTemplate: JsonLine,
1409
+ fromNode: RGLineTarget | RGNode,
1410
+ toNode: RGLineTarget | RGNode
1411
+ }) => void;
1412
+ /**
1413
+ * Triggered after the line creation or modification endpoint is completed, before onLineBeCreated is triggered. You can return false to prevent the creation of the line, or modify the line information.
1414
+ * @param fromNode The starting node
1415
+ * @param toNode The target node
1416
+ * @param lineTemplate The line information (JsonLine)
1417
+ *
1418
+ */
1419
+ beforeCreateLine?: (lineInfo: {
1420
+ lineJson: JsonLine,
1421
+ fromNode: RGLineTarget | RGNode,
1422
+ toNode: RGLineTarget | RGNode
1423
+ }) => void | false;
1424
+ /**
1425
+ * Triggered when a new line is created or the endpoint is modified
1426
+ * - Note: The process of modifying the endpoints (start or end) of a line is actually to first delete the line, and then create a new line with the same id (all other attributes of the line will be retained) through the onLineBeCreated event.
1427
+ * - Please be sure to add the new line to the graph through the graphInstance.addLines method in the onLineBeCreated event, otherwise the line will not actually be created.
1428
+ * @param fromNode The starting node
1429
+ * @param toNode The target node
1430
+ * @param lineTemplate The line information (JsonLine)
1431
+ */
1432
+ onLineBeCreated?: (lineInfo: {
1433
+ lineJson: JsonLine,
1434
+ fromNode: RGLineTarget | RGNode,
1435
+ toNode: RGLineTarget | RGNode
1436
+ }) => void;
1437
+ /**
1438
+ * Triggered before new nodes are added (via setJsonData, addNodes methods) to the graph
1439
+ * @param nodes The array of jsonNode objects that are about to be added
1440
+ */
1441
+ beforeAddNodes?: (nodes: JsonNode[]) => void;
1442
+ /**
1443
+ * Triggered before new lines are added (via setJsonData, addLines methods) to the graph
1444
+ * @param lines The array of jsonLine objects that are about to be added
1445
+ */
1446
+ beforeAddLines?: (lines: JsonLine[]) => void;
1447
+ /**
1448
+ * Triggered when the keyboard is pressed down in the graph area
1449
+ * @param e
1450
+ */
1451
+ onKeyboardDown?: (e: KeyboardEvent) => void;
1452
+ /**
1453
+ * Triggered when the keyboard is released in the graph area
1454
+ * @param e
1455
+ */
1456
+ onKeyboardUp?: (e: KeyboardEvent) => void;
1457
+ /**
1458
+ * Triggered when canvas drag starts
1459
+ * @param canvasMoveStartPosition The initial position of the canvas when dragging starts
1460
+ * @param eventClientStartPosition The client position of the user event when it starts
1461
+ * @param e
1462
+ */
1463
+ onCanvasDragStart?: (canvasMoveStartPosition: RGPosition, eventClientStartPosition: RGPosition, e: RGUserEvent) => void;
1464
+ /**
1465
+ * Triggered when the force-directed layout calculation is completed
1466
+ */
1467
+ onForceLayoutFinish?: () => void;
1468
+ /**
1469
+ * Triggered before performing canvas move scroll, returning true indicates to prevent the scroll from continuing
1470
+ * @param buffX The X offset that is about to be scrolled
1471
+ * @param buffY The Y offset that is about to be scrolled
1472
+ * @return true = Abort Scroll
1473
+ */
1474
+ beforeScrollStart?: (buffX: number, buffY: number, e: Event) => true | undefined | void;
1475
+ }