@relation-graph/react 3.0.0 → 3.0.1

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 +251 -23
  3. package/relation-graph.mjs +7368 -5902
  4. package/relation-graph.umd.js +251 -23
  5. package/types/packages/platforms/react/src/index.d.ts +98 -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 +1 -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 +1 -1
  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 +18 -18
  123. package/types/packages/platforms/vue2/src/core4vue/RGLinePath.vue.d.ts +4 -28
  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 +138 -1692
  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 +14 -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 +77 -0
  197. package/types/packages/relation-graph-models/models/RelationGraphWith2Data2Analysis.d.ts +172 -0
  198. package/types/packages/relation-graph-models/models/RelationGraphWith2Data3Update.d.ts +257 -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 +81 -21
  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 -36
  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 +1472 -0
  233. package/types/react.d.ts +38 -38
  234. package/types/vue3.d.ts +229 -229
@@ -0,0 +1,1472 @@
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
+ useTextPath?: boolean
317
+ onPathStartOffset?: string
318
+ textAnchor?: string
319
+ lineDirection?: string
320
+ polyLineStartDistance?: number
321
+ disablePointEvent?: boolean
322
+ data?: Record<string, any>
323
+ cssVars?: Record<string, any>
324
+ force_elastic?: number
325
+ textOffset_x?: number
326
+ textOffset_y?: number
327
+ animation?: number
328
+ dashType?: number
329
+ lineRadius?: number
330
+ forDisplayOnly?: boolean
331
+ junctionOffset?: number
332
+ fromJunctionPoint?: RGJunctionPoint
333
+ toJunctionPoint?: RGJunctionPoint
334
+ fromJuctionPointOffsetX?: number
335
+ fromJuctionPointOffsetY?: number
336
+ toJuctionPointOffsetX?: number
337
+ toJuctionPointOffsetY?: number
338
+ hidden?: boolean
339
+ }
340
+ /**
341
+ * RGFakeLine can use non-node objects as the start or end points of fake nodes, enabling more complex line connection requirements
342
+ * 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
343
+ * By setting fromType and toType to identify the start and end types of the fake line
344
+ * 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.
345
+ */
346
+ export type RGFakeLine = JsonLine & {
347
+ id: string;
348
+ fromType: RGInnerConnectTargetType | string;
349
+ toType: RGInnerConnectTargetType | string;
350
+ }
351
+ /**
352
+ * Enhanced line type for runtime in relation-graph
353
+ * 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.
354
+ */
355
+ export type RGLine = JsonLine & {
356
+ id: string;
357
+ isReverse?: boolean // 自动计算,无需设置
358
+ }
359
+ /**
360
+ * 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
361
+ * 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
362
+ * - line : The RGLine object corresponding to this link
363
+ * - fromNode : The RGNode object representing the start node of the line
364
+ * - toNode : The RGNode object representing the end node of the line
365
+ * - totalLinesBetweenNodes : The total number of lines between the fromNode and toNode
366
+ * - currentLineIndex : The index of the current line among all lines between the fromNode and toNode
367
+ * - 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
368
+ * - 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
369
+ *
370
+ */
371
+ export type RGLink = {
372
+ lineId: string
373
+ line: RGLine,
374
+ fromNode: RGNode
375
+ toNode: RGNode
376
+ totalLinesBetweenNodes: number
377
+ currentLineIndex: number
378
+ rgShouldRender?: boolean
379
+ rgCalcedVisibility?: boolean // allLines(!hidden) && (fromNode rgCalcedVisibility) && (toNode rgCalcedVisibility)
380
+ };
381
+ /**
382
+ * @deprecated Use RGLink instead
383
+ */
384
+ export type RGElementLine = RGLink;
385
+ /**
386
+ * RGJsonData is a JSON data format for quickly setting graph data. Through it, you can quickly import data using the graphInstance.setJsonData method.
387
+ * It is a shortcut method, equivalent to the following code:
388
+ * ```ts
389
+ * const jsonData = {
390
+ * rootId: 'rootNodeId',
391
+ * nodes: [...],
392
+ * lines: [...]
393
+ * };
394
+ * graphInstance.addNodes(jsonData.nodes);
395
+ * graphInstance.addLines(jsonData.lines);
396
+ * graphInstance.setRootNodeId(jsonData.rootId);
397
+ * ```
398
+ */
399
+ export type RGJsonData = {
400
+ rootId?: string
401
+ nodes: JsonNode[]
402
+ lines: JsonLine[]
403
+ fakeLines?: RGFakeLine[]
404
+ };
405
+ /**
406
+ * RGGraphData is the internal data structure used by relation-graph to manage graph data
407
+ */
408
+ export type RGGraphData = {
409
+ rootNode?: RGNode,
410
+ nodes: RGNode[],
411
+ normalLines: RGLine[],
412
+ fakeLines: RGFakeLine[]
413
+ };
414
+ /**
415
+ * Coordinate type for relation-graph
416
+ */
417
+ export type RGCoordinate = {
418
+ x: number;
419
+ y: number;
420
+ };
421
+ /**
422
+ * Rectangle box type for counting node areas
423
+ * For example, you can get the rectangular area occupied by the specified nodes through the following code:
424
+ * ```ts
425
+ * const nodesBoxInfo: RGNodesRectBox = graphInstance.getNodesRectBox(someNodes);
426
+ * ```
427
+ */
428
+ export type RGNodesRectBox = {
429
+ width: number;
430
+ height: number;
431
+ minX: number;
432
+ minY: number;
433
+ maxX: number;
434
+ maxY: number;
435
+ };
436
+ /**
437
+ * Position type for relation-graph
438
+ * Generally used to save position coordinates
439
+ */
440
+ export type RGPosition = RGCoordinate;
441
+ /**
442
+ * Drag callback type used in internal logic processing of relation-graph
443
+ * @inner
444
+ */
445
+ export type RGDraggingCallback = (
446
+ offsetX: number,
447
+ offsetY: number,
448
+ startElPosition: { x: number; y: number },
449
+ startEventPosition: { x: number; y: number },
450
+ event: MouseEvent | TouchEvent
451
+ ) => void;
452
+ /**
453
+ * Drag end callback type used in internal logic processing of relation-graph
454
+ * @inner
455
+ */
456
+ export type RGDraggedCallback = (
457
+ buffX: number,
458
+ buffY: number,
459
+ event: MouseEvent | TouchEvent
460
+ ) => void;
461
+ /**
462
+ * Layout options fragment: node alignment settings
463
+ * - 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
464
+ * - 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
465
+ */
466
+ export type RGLayoutOptions4Alignment = {
467
+ alignItemsX?: 'start' | 'center' | 'end';
468
+ alignItemsY?: 'start' | 'center' | 'end';
469
+ };
470
+ /**
471
+ * Layout core options type
472
+ * - layoutName: Layout algorithm name such as 'force', 'center', 'tree', etc.
473
+ * - layoutDirection: Layout direction, 'h' means horizontal layout, 'v' means vertical layout
474
+ * - 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.
475
+ * - 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.
476
+ * - 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.
477
+ */
478
+ export type RGLayoutOptionsCore = RGLayoutOptions4Alignment & {
479
+ layoutName: string;
480
+ layoutDirection?: 'h' | 'v';
481
+ fixedRootNode?: boolean
482
+ autoLayouting?: boolean
483
+ supportAutoLayout?: boolean
484
+ };
485
+ /**
486
+ * Force-directed layout options type
487
+ * - 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.
488
+ * - 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.
489
+ * - byNode: Whether to enable repulsion calculation between nodes, default is true.
490
+ * - byLine: Whether to enable elastic force calculation between lines, default is true.
491
+ * - 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.
492
+ * - 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.
493
+ *
494
+ */
495
+ export type RGForceLayoutOptions = RGLayoutOptionsCore & {
496
+ fastStart?: boolean;
497
+ maxLayoutTimes?: number;
498
+ byNode?: boolean;
499
+ byLine?: boolean;
500
+ force_node_repulsion?: number;
501
+ force_line_elastic?: number;
502
+ };
503
+ /**
504
+ * Center layout options type
505
+ * - 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.
506
+ * - 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.
507
+ */
508
+ export type RGCenterLayoutOptions = RGForceLayoutOptions & {
509
+ distance_coefficient?: number
510
+ levelDistance?: number[]
511
+ };
512
+ /**
513
+ * Tree layout options type
514
+ * - from: The node ID from which the tree layout starts
515
+ * - treeNodeGapH: Horizontal gap between tree nodes, default is 50
516
+ * - treeNodeGapV: Vertical gap between tree nodes, default is 50
517
+ * - 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.
518
+ * - 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
519
+ * - 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.
520
+ * - 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.
521
+ * - 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'.
522
+ * - 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'.
523
+ */
524
+ export type RGTreeLayoutOptions = RGLayoutOptionsCore & {
525
+ from: string
526
+ treeNodeGapH?: number
527
+ treeNodeGapV?: number
528
+ levelGaps?: number[]
529
+ layoutExpansionDirection?: 'start' | 'center' | 'end'
530
+ simpleTree?: boolean;
531
+ ignoreNodeSize?: boolean;
532
+ alignParentItemsX?: 'start' | 'center' | 'end';
533
+ alignParentItemsY?: 'start' | 'center' | 'end';
534
+ };
535
+ /**
536
+ * Layout options type for relation-graph
537
+ * Supported layoutName include:
538
+ * - tree: Tree layout, using RGTreeLayout class for layout
539
+ * - center: Center layout, using RGCenterLayout class for layout
540
+ * - circle: Circle layout, using RGCircleLayout class for layout
541
+ * - force: Force-directed layout, using RGForceLayout class for layout
542
+ * - fixed: Fixed layout, using RGFixedLayout class for layout
543
+ * - smart-tree: Smart tree layout, using RGSmartTreeLayout class for layout
544
+ * - io-tree: Input-output tree layout, using RGIOTreeLayout class for layout
545
+ * - folder: Folder layout, using RGFolderLayout class for layout
546
+ */
547
+ export type RGLayoutOptions =
548
+ (RGCenterLayoutOptions & { layoutName: 'center' })
549
+ | (RGForceLayoutOptions & { layoutName: 'force' })
550
+ | (RGTreeLayoutOptions & { layoutName: 'tree' })
551
+ | (RGLayoutOptionsCore & { layoutName: 'circle' })
552
+ | (RGLayoutOptionsCore & { layoutName: 'fixed' })
553
+ | (RGTreeLayoutOptions & { layoutName: 'smart-tree' })
554
+ | (RGTreeLayoutOptions & { layoutName: 'io-tree' })
555
+ | (RGTreeLayoutOptions & { layoutName: 'folder' })
556
+
557
+ /**
558
+ * Layout engine interface type for relation-graph internal use
559
+ * @inner
560
+ */
561
+ export interface RGLayout {
562
+ isMainLayouer: boolean
563
+ requireLinks: boolean
564
+ allNodes: RGNode[]
565
+ rootNode?: RGNode
566
+ layoutOptions: RGLayoutOptions
567
+ networkAnalyzer: RGNetworkAnalyzer
568
+ setLinks: (links: RGLink[]) => void
569
+ placeNodes: (allNodes: RGNode[], rootNode: RGNode) => void
570
+ start?: () => void
571
+ stop?: () => void
572
+ }
573
+
574
+ /**
575
+ * Complete configuration type that includes all options available for users to configure
576
+ */
577
+ export type RGOptionsInited = {
578
+ instanceId: string
579
+ debug: boolean
580
+ showToolBar: boolean
581
+ backgroundColor: string
582
+ disableWheelEvent: boolean
583
+ wheelEventAction: 'zoom' | 'scroll' | 'none'
584
+ dragEventAction: 'move' | 'selection' | 'none'
585
+ disableDragNode: boolean
586
+ disableDragLine: boolean
587
+ canvasMoveMode: boolean
588
+ disableNodePointEvent: boolean
589
+ disableLinePointEvent: boolean
590
+ toolBarDirection: string
591
+ toolBarPositionH: string
592
+ toolBarPositionV: string
593
+ defaultExpandHolderPosition: 'hide' | 'left' | 'top' | 'right' | 'bottom'
594
+ defaultNodeColor: string
595
+ defaultNodeBorderColor: string,
596
+ defaultNodeBorderWidth: number,
597
+ defaultNodeBorderRadius: number,
598
+ defaultNodeShape: RGNodeShape,
599
+ defaultNodeWidth?: number
600
+ defaultNodeHeight?: number
601
+ checkedItemBackgroundColor?: string //
602
+ defaultLineTextOffset_x?: number,
603
+ defaultLineTextOffset_y?: number,
604
+ defaultLineColor: string
605
+ defaultLineWidth: number
606
+ defaultLineShape?: RGLineShape
607
+ // defaultShowLineLabel: boolean
608
+ // hideNodeContentByZoom: boolean
609
+ defaultJunctionPoint?: RGJunctionPoint
610
+ defaultLineJunctionOffset: number,
611
+ // placeSingleNode: boolean
612
+ placeOtherNodes: boolean
613
+ lineUseTextPath: boolean
614
+ lineTextMaxLength: number
615
+ multiLineDistance: number
616
+ checkedNodeId: string // private
617
+ checkedLineId: string // private
618
+ draggingNodeId: string // private
619
+ performanceMode: boolean,
620
+ fullscreenElementXPath: string,
621
+ data: any
622
+ viewHeight: string
623
+ defaultLineMarker: {
624
+ markerWidth: number
625
+ markerHeight: number
626
+ refX: number
627
+ refY: number
628
+ viewBox: string
629
+ data: string
630
+ }
631
+ layout: RGLayoutOptions
632
+ canvasZoom: number // private
633
+ mouseWheelSpeed: number // private
634
+ minCanvasZoom: number // private
635
+ maxCanvasZoom: number // private
636
+ placeOtherGroup: boolean
637
+ defaultPolyLineRadius: number,
638
+ reLayoutWhenExpandedOrCollapsed: boolean
639
+ creatingSelection: boolean
640
+ selectionView: RGSelectionView
641
+ creatingNodePlot: boolean
642
+ showTemplateNode: boolean
643
+ newNodeTemplate: any
644
+ creatingLinePlot: boolean
645
+ newLineTemplate: RGLine
646
+ newLinkTemplate: any
647
+ definitelyNoDataProviderNeeded: boolean
648
+ }
649
+ /**
650
+ * Complete configuration type that includes all runtime state options, none of which can be directly configured by users
651
+ */
652
+ export type RGOptionsFull = RGOptionsInited & {
653
+ snapshotting: boolean
654
+ graphLoading: boolean
655
+ enableNodeXYAnimation: boolean
656
+ enableCanvasTransformAnimation: boolean
657
+ graphLoadingText: string
658
+ editingLineController: RGEditingLine,
659
+ editingController: RGEditingNodes,
660
+ nodeConnectController: RGConnectingNode,
661
+ showReferenceLine: boolean,
662
+ referenceLineAdsorption: boolean,
663
+ editingReferenceLine: {
664
+ show: boolean,
665
+ directionV: boolean,
666
+ directionH: boolean,
667
+ v_x: number,
668
+ v_y: number,
669
+ v_height: number,
670
+ h_x: number,
671
+ h_y: number,
672
+ h_width: number
673
+ },
674
+ showMiniView: boolean,
675
+ miniViewVisibleHandle: {
676
+ x: number,
677
+ y: number,
678
+ width: number,
679
+ height: number,
680
+ emptyContent: boolean
681
+ }
682
+ instanceId: string
683
+ viewSize: { width: number; height: number }
684
+ canvasSize: {
685
+ width: number
686
+ height: number
687
+ }
688
+ canvasOffset: {
689
+ x: number
690
+ y: number
691
+ }
692
+ fullscreen: boolean // private
693
+ showEasyView?: boolean // private
694
+ canvasOpacity?: number // private
695
+ }
696
+ /**
697
+ * Partial configuration type for relation-graph, users can configure any subset of options
698
+ */
699
+ export type RGOptions = Partial<RGOptionsInited>;
700
+ /**
701
+ * When the user performs a selection operation on the canvas (event: onCanvasSelectionEnd), the type of selection view information passed
702
+ */
703
+ export type RGSelectionView = {
704
+ x: number
705
+ y: number
706
+ width: number
707
+ height: number
708
+ };
709
+
710
+ /**
711
+ * Event handler type for relation-graph events
712
+ * @inner
713
+ */
714
+ export type RGEventHandler = (eventName: RGEventNames, ...args: any[]) => void | any;
715
+ /**
716
+ * Event emit hook type for relation-graph events
717
+ * @inner
718
+ */
719
+ export type RGEventEmitHook = (eventName: RGEventNames, ...args: any[]) => void | any;
720
+ /**
721
+ * Control point type for RGLineShape.Line44 lines
722
+ * @inner
723
+ */
724
+ export type RGCtrlPointForLine44 = {
725
+ pIndex: number,
726
+ optionName: string,
727
+ direction: 'v' | 'h',
728
+ x: number,
729
+ y: number,
730
+ startDirection: RGDirection,
731
+ endDirection: RGDirection,
732
+ hide?: boolean
733
+ }
734
+
735
+ /**
736
+ * The exposed interface type of the relation-graph component instance
737
+ * @inner
738
+ */
739
+ export interface RelationGraphExpose {
740
+ getInstance(): RelationGraphInstance;
741
+ }
742
+
743
+ /**
744
+ * Props type for RGNodeSlot component
745
+ */
746
+ export interface RGNodeSlotProps {
747
+ node: RGNode
748
+ defaultExpandHolderPosition?: string
749
+ dragging?: boolean
750
+ checked?: boolean
751
+ }
752
+
753
+ /**
754
+ * Props type for RGLineSlot component
755
+ * @inner
756
+ */
757
+ export interface RGLinePeelProps {
758
+ line: RGLine | RGFakeLine
759
+ checked?: boolean
760
+ lineUseTextPath?: boolean
761
+ graphInstanceId?: string
762
+ }
763
+
764
+ /**
765
+ * Custom line slot component Props type
766
+ * @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.
767
+ * @param checked Whether the current line is selected
768
+ * @param lineUseTextPath Whether the line uses textPath to typeset text, allowing the text to be arranged along the line path
769
+ * @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)
770
+ *
771
+ */
772
+ export interface RGLineSlotProps {
773
+ lineConfig: RGGenerateLineConfig
774
+ checked?: boolean
775
+ lineUseTextPath?: boolean
776
+ graphInstanceId?: string
777
+ }
778
+
779
+ /**
780
+ * Props type for RGLinePath component
781
+ * @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.
782
+ * @param linePathInfo The path information of the line, including path data, text position, etc., used for rendering the line path
783
+ * @param lineUseTextPath Whether the line uses textPath to typeset text, allowing the text to be arranged along the line path
784
+ * @param checked Whether the current line is selected
785
+ * @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)
786
+ *
787
+ */
788
+ export interface RGLinePathProps {
789
+ lineConfig: RGGenerateLineConfig
790
+ linePathInfo: RGLinePathInfo
791
+ lineUseTextPath?: boolean
792
+ checked?: boolean
793
+ graphInstanceId?: string
794
+ }
795
+
796
+ /**
797
+ * Props type for RGLineText component
798
+ * @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.
799
+ * @param linePathInfo The path information of the line, including path data, text position, etc., used for rendering the line path
800
+ * @param checked Whether the current line is selected
801
+ *
802
+ */
803
+ export interface RGLineTextProps {
804
+ lineConfig: RGGenerateLineConfig
805
+ linePathInfo: RGLinePathInfo
806
+ checked?: boolean
807
+ }
808
+
809
+ /**
810
+ * Props type for <RelationGraph /> component
811
+ * @param options Configuration options for relation-graph
812
+ * @param relationGraphCore The core class of relation-graph, default is RelationGraphCore
813
+ */
814
+ export type RelationGraphProps = RGListeners & {
815
+ options: RGOptions;
816
+ relationGraphCore?: new (...args: any[]) => RelationGraphCore;
817
+ };
818
+
819
+ /**
820
+ * Positioning props for <RGToolBar /> components
821
+ * @param direction 'v' means vertical toolbar, 'h' means horizontal toolbar
822
+ * @param positionH 'left' means left-aligned, 'center' means center-aligned, 'right' means right-aligned
823
+ * @param positionV 'top' means top-aligned, 'center' means center-aligned, 'bottom' means bottom-aligned
824
+ */
825
+ export interface RGToolBarProps {
826
+ direction?: 'v' | 'h' | string,
827
+ positionH?: 'left' | 'center' | 'right' | string,
828
+ positionV?: 'top' | 'center' | 'bottom' | string,
829
+ }
830
+
831
+ /**
832
+ * Positioning props for <RGMiniView /> components
833
+ * @param position Position of the mini view: 'tl' | 'tr' | 'bl' | 'br' | 'top' | 'right' | 'bottom' | 'left'
834
+ * @param width Width of the mini view
835
+ * @param height Height of the mini view
836
+ */
837
+ export interface RGMiniViewProps {
838
+ position?: RGWidgetPosition,
839
+ width?: string,
840
+ height?: string,
841
+ className?: string;
842
+ style?: Record<string, string | number | undefined>,
843
+ }
844
+
845
+ /**
846
+ * Positioning props for <RGEditingNearNodeWidget /> components
847
+ * @param position Position of the widget: 'tl' | 'tr' | 'bl' | 'br' | 'top' | 'right' | 'bottom' | 'left'
848
+ */
849
+ export interface RGWidgetProps {
850
+ position?: RGWidgetPosition
851
+ }
852
+
853
+ /**
854
+ * Props type for RGEditingLineController component
855
+ * @inner
856
+ */
857
+ export interface RGEditingLineControllerProps {
858
+ textEditable?: boolean
859
+ onMoveLineVertexStart?: (type: RGLineEditPoint, line: RGLine) => void
860
+ onMoveLineVertexEnd?: RGLineVertexBeDroppedEventHandler
861
+ onLinePathChanged?: (line: RGLine, params: any) => void
862
+ onLineTextDragEnd?: (line: RGLine) => void
863
+ onLineTextChanged?: (line: RGLine) => void
864
+ }
865
+
866
+ /**
867
+ * @inner
868
+ */
869
+ export type RGLineConnectEventHandler = (fromNode: RGNode | RGLineTarget | RGPosition, toNode: RGNode | RGLineTarget | RGPosition, newLineJson?: JsonLine) => void;
870
+ /**
871
+ * @inner
872
+ */
873
+ export type RGLineVertexBeDroppedEventHandler = (fromNode: RGNode | RGLineTarget | RGPosition, toNode: RGNode | RGLineTarget | RGPosition, newLineJson?: JsonLine) => void;
874
+ export type JsonNodeLike = Partial<JsonNode>;
875
+ export type JsonLineLike = Partial<JsonLine>;
876
+ export type JsonNodeTemplate = JsonNodeLike;
877
+ export type JsonLineTemplate = JsonLineLike;
878
+
879
+ /**
880
+ * @inner
881
+ */
882
+ export type CreatingLinePlotOptions = {
883
+ onCreateLine: RGLineConnectEventHandler | undefined
884
+ isReverse?: boolean,
885
+ template?: JsonLineLike
886
+ fromNode?: RGLineTarget
887
+ };
888
+ /**
889
+ * @inner
890
+ */
891
+ export type CreatingNodePlotOptions = {
892
+ templateNode: JsonNodeLike
893
+ templateMove?: (x: number, y: number) => void
894
+ onCreateNode: (x: number, y: number, nodeTemplate?: JsonNodeLike) => void
895
+ };
896
+
897
+ /**
898
+ * Props type for <RGConnectSource> component
899
+ * The RGConnectSource component allows any element to have the functionality of a connection starting point.
900
+ * @param lineTemplate The template information for the connection line, which can be partial properties of JsonLine
901
+ * @param onConnectStart Callback function triggered when starting to initiate a connection line
902
+ * @param onConnectEnd Callback function triggered when the connection line initiation ends
903
+ * @param className Custom class name for the component
904
+ * @param style Custom styles for the component
905
+ * @example
906
+ * ```tsx
907
+ * import {RGLineShape} from 'relation-graph-react';
908
+ *
909
+ * <RGConnectSource
910
+ * :lineTemplate="{ color: 'red', lineShape: RGLineShape.StandardCurve }"
911
+ * :onConnectEnd="(fromNode, toNode, newLineJson) => {
912
+ * console.log('Connection ended:', fromNode, toNode, newLineJson);
913
+ * // You can add the new line to the graph here
914
+ * graphInstance.addLines([newLineJson]);
915
+ * }"
916
+ * >
917
+ * <div class="my-connect-source">
918
+ * Drag from here to connect
919
+ * </div>
920
+ * </RGConnectSource>
921
+ * ```
922
+ */
923
+ export interface RGConnectSourceProps {
924
+ lineTemplate: JsonLineLike;
925
+ onConnectStart?: (newLineTemplate?: JsonLineLike, event?: RGUserEvent) => void;
926
+ onConnectEnd?: RGLineConnectEventHandler; // default is true
927
+ className?: string;
928
+ style?: Record<string, string | number | undefined>,
929
+ }
930
+
931
+ /**
932
+ * Component <RGConnectTarget> Props type
933
+ * 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.
934
+ * 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.
935
+ * @param junctionPoint Specifies the junction point information of the connection target
936
+ * @param targetId The target ID corresponding to the connection target, which can be a node ID or a special identifier
937
+ * @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
938
+ * @param targetData Additional data for the connection target, which can store any information related to the target
939
+ * @param onLineVertexBeDropped Callback function triggered when a line endpoint is dragged to this connection target and released
940
+ * @param lineTemplate The template information for the connection line, which can be partial properties of JsonLine
941
+ * @param disableDrop Whether to disable the function of dragging the line endpoint to this connection target for connection, default is false
942
+ * @param disableDrag Whether to disable the function of initiating line connection from this connection target, default is false
943
+ * @param onDragConnectStart Callback function triggered when starting to drag from this connection target to initiate a connection line
944
+ * @param onDragConnectEnd Callback function triggered when the connection line initiated by dragging from this connection target is released
945
+ * @param className Custom class name for the component
946
+ * @param style Custom styles for the component
947
+ * @example
948
+ * ```tsx
949
+ * import {RGJunctionPoint, RGLineShape} from 'relation-graph-react';
950
+ *
951
+ * <RGConnectTarget
952
+ * :junctionPoint="RGJunctionPoint.Bottom"
953
+ * targetId="my-target-1"
954
+ * :targetData="{ info: 'additional data' }"
955
+ * :lineTemplate="{ color: '#ff0000', lineShape: RGLineShape.StandardStraight, data: { info: 'additional data' } }"
956
+ * >
957
+ * <div class="my-connect-target">
958
+ * Drop line here or drag from here to connect
959
+ * </div>
960
+ * </RGConnectTarget>
961
+ * ```
962
+ */
963
+ export interface RGConnectTargetProps {
964
+ junctionPoint: RGJunctionPoint;
965
+ targetId: string;
966
+ targetType?: string;
967
+ targetData?: Record<string, any>;
968
+ onLineVertexBeDropped?: RGLineVertexBeDroppedEventHandler;
969
+ lineTemplate?: JsonLineLike;
970
+ disableDrop?: boolean;
971
+ disableDrag?: boolean;
972
+ onDragConnectStart?: (newLineTemplate?: JsonLineLike, event?: RGUserEvent) => void;
973
+ onDragConnectEnd?: RGLineConnectEventHandler; // default is true
974
+ className?: string;
975
+ style?: Record<string, string | number | undefined>,
976
+ }
977
+
978
+ /**
979
+ * 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.
980
+ * @deprecated
981
+ */
982
+ export interface RGWatermarkProps {
983
+ forImage?: boolean,
984
+ forDisplay?: boolean,
985
+ position?: RGWidgetPosition,
986
+ width?: string,
987
+ height?: string
988
+ }
989
+
990
+ /**
991
+ * 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.
992
+ * @deprecated
993
+ */
994
+ export interface RGBackgroundProps {
995
+ forImage?: boolean,
996
+ forDisplay?: boolean,
997
+ }
998
+
999
+ /**
1000
+ * @inner
1001
+ */
1002
+ export type RGLineTextPosition = {
1003
+ x: number;
1004
+ y: number;
1005
+ rotate: number;
1006
+ };
1007
+ /**
1008
+ * Configuration parameter type passed in when generating line path and rendering information
1009
+ * @param line The line object or fake line object
1010
+ * @param from The starting object of the line
1011
+ * @param to The ending object of the line
1012
+ * @param totalLinesBetweenNodes Total number of lines between the two nodes (including this line)
1013
+ * @param currentLineIndex The index of the current line among the lines between the two nodes (starting from 0)
1014
+ * @param defaultOptions Global default configuration options for rendering lines
1015
+ */
1016
+ export type RGGenerateLineConfig = {
1017
+ line: RGLine | RGFakeLine,
1018
+ from?: RGLineTarget,
1019
+ to?: RGLineTarget,
1020
+ totalLinesBetweenNodes?: number,
1021
+ currentLineIndex?: number,
1022
+ defaultOptions?: any
1023
+ }
1024
+ /**
1025
+ * English: Callback function type for generating fake line target objects when rendering custom lines
1026
+ * @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.
1027
+ * @param targetId The id of the connectable object (e.g., node id, RGConnectTarget's targetId)
1028
+ * @param fakeLine The fake line object
1029
+ * @returns Returns the corresponding line target object
1030
+ *
1031
+ */
1032
+ export type RGFakeLineTargetRender = (targetType: string, targetId: string, fakeLine: RGFakeLine) => RGLineTarget;
1033
+ /**
1034
+ * @inner
1035
+ */
1036
+ export type RGGenerateLinePrams = {
1037
+ line: RGLine,
1038
+ totalLinesBetweenNodes: number,
1039
+ currentLineIndex: number,
1040
+ lineDirection: 'v' | 'h',
1041
+ lineShape: RGLineShape,
1042
+ lineRadius: number,
1043
+ fromJunctionPoint: RGJunctionPoint,
1044
+ toJunctionPoint: RGJunctionPoint,
1045
+ fx: number,
1046
+ fy: number,
1047
+ fcx: number,
1048
+ fcy: number,
1049
+ f_W: number,
1050
+ f_H: number,
1051
+ tx: number,
1052
+ ty: number,
1053
+ tcx: number,
1054
+ tcy: number,
1055
+ t_W: number,
1056
+ t_H: number
1057
+ }
1058
+ /**
1059
+ * Line path information generated by relation-graph
1060
+ * @param pathData SVG Path data of the line
1061
+ * @param pathCommands Command point information of the line path
1062
+ * @param textPosition Position and rotation information of the line text
1063
+ * @param points Array of key point coordinates on the line path
1064
+ * @param startDirection Line start direction (only valid for certain line shapes)
1065
+ * @param endDirection Line end direction (only valid for certain line shapes)
1066
+ */
1067
+ export type RGLinePathInfo = {
1068
+ pathData: string;
1069
+ pathCommands: RGLinePathCommands;
1070
+ textPosition: RGLineTextPosition,
1071
+ points: RGCoordinate[],
1072
+ startDirection?: RGDirection,
1073
+ endDirection?: RGDirection,
1074
+ };
1075
+ /**
1076
+ * @inner
1077
+ */
1078
+ export type CalcNode = {
1079
+ rgNode: RGNode;
1080
+ x: number;
1081
+ y: number;
1082
+ width: number;
1083
+ height: number;
1084
+ };
1085
+ /**
1086
+ * @inner
1087
+ */
1088
+ export type WriteableData<T> = {
1089
+ set(this: void, value: T): void;
1090
+ // value(): T;
1091
+ // /**
1092
+ // * Update value using callback and inform subscribers.
1093
+ // * @param updater callback
1094
+ // */
1095
+ // update(this: void, updater: (v: T) => T): void;
1096
+ }
1097
+ /**
1098
+ * @inner
1099
+ */
1100
+ export type ReactiveDataStores = {
1101
+ store4Options: WriteableData<RGOptionsFull>,
1102
+ store4ShouldRenderNodes: WriteableData<RGNode[]>,
1103
+ store4ShouldRenderLines: WriteableData<RGLine[]>,
1104
+ store4ShouldRenderFakeLines: WriteableData<RGFakeLine[]>,
1105
+ optionsRef?: any, // Store Vue reactive data
1106
+ shouldRenderNodesRef?: any, // Store Vue reactive data
1107
+ shouldRenderLinesRef?: any, // Store Vue reactive data
1108
+ shouldRenderFakeLinesRef?: any // Store Vue reactive data
1109
+ }
1110
+ /**
1111
+ * @inner
1112
+ */
1113
+ export type ReactiveDataUpdaters = {
1114
+ updateStore4Options: (newValue: RGOptionsFull) => void,
1115
+ updateStore4ShouldRenderNodes: (newValue: RGNode[]) => void,
1116
+ updateStore4ShouldRenderLines: (newValue: RGLine[]) => void,
1117
+ updateStore4FakeLines: (newValue: RGFakeLine[]) => void,
1118
+ }
1119
+ /**
1120
+ * Reactive data object returned by hooks provided by the relation-graph component:
1121
+ * - information about the line being created (the line being dragged into the canvas)
1122
+ * @param creating Whether a line is being created
1123
+ * @param fromTarget The starting target of the line being created
1124
+ * @param toTarget The ending target of the line being created
1125
+ * @param lineJson The JsonLine information of the line being created
1126
+ */
1127
+ export type RGCreatingLine = {
1128
+ creating: true,
1129
+ fromTarget?: RGLineTarget,
1130
+ toTarget?: RGLineTarget,
1131
+ lineJson?: JsonLine
1132
+ } | {
1133
+ creating: false
1134
+ }
1135
+
1136
+ /**
1137
+ * Reactive data object returned by hooks provided by the relation-graph component:
1138
+ * - information about the node being created (the node being dragged into the canvas)
1139
+ * @param creating Whether a node is being created
1140
+ * @param nodeJson The JsonNode information of the node being created
1141
+ */
1142
+ export type RGCreatingNode = {
1143
+ creating: true,
1144
+ nodeJson?: JsonNode
1145
+ } | {
1146
+ creating: false
1147
+ }
1148
+ /**
1149
+ * Reactive data object returned by hooks provided by the relation-graph component:
1150
+ * - information about the nodes being edited
1151
+ * @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.
1152
+ * @param nodes The array of nodes being edited
1153
+ * @param x The X position of the editing box
1154
+ * @param y The Y position of the editing box
1155
+ * @param width The width of the editing box
1156
+ * @param height The height of the editing box
1157
+ */
1158
+ export type RGEditingNodes = {
1159
+ show: boolean,
1160
+ nodes: RGNode[],
1161
+ x: number,
1162
+ y: number,
1163
+ width: number,
1164
+ height: number
1165
+ }
1166
+ /**
1167
+ * Reactive data object returned by hooks provided by the relation-graph component:
1168
+ * - Information about the node being connected when creating a line
1169
+ * @param x The X position of the connecting box
1170
+ * @param y The Y position of the connecting box
1171
+ * @param width The width of the connecting box
1172
+ * @param height The height of the connecting box
1173
+ */
1174
+ export type RGConnectingNode = {
1175
+ show: boolean,
1176
+ node: RGNode | RGLineTarget | RGRectTarget,
1177
+ x: number,
1178
+ y: number,
1179
+ width: number,
1180
+ height: number
1181
+ }
1182
+ /**
1183
+ * Reactive data object returned by hooks provided by the relation-graph component:
1184
+ * - Information about the line being edited
1185
+ * @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.
1186
+ * @param line The line being edited
1187
+ * @param startPoint The starting point of the line being edited
1188
+ * @param endPoint The ending point of the line being edited
1189
+ */
1190
+ export type RGEditingLine = {
1191
+ show: boolean,
1192
+ line: RGLine | null,
1193
+ startPoint: RGPosition,
1194
+ endPoint: RGPosition,
1195
+ text: {
1196
+ show: boolean,
1197
+ x: number,
1198
+ y: number,
1199
+ width: number,
1200
+ height: number
1201
+ },
1202
+ ctrlPoints: RGPosition[],
1203
+ selectedLines: string[],
1204
+ line44Splits: RGCtrlPointForLine44[],
1205
+ line49Points: RGPosition[],
1206
+ ctrlPoint1: RGPosition,
1207
+ ctrlPoint2: RGPosition,
1208
+ toolbar: RGPosition
1209
+ }
1210
+ /**
1211
+ * Reactive data object returned by hooks provided by the relation-graph component:
1212
+ * - Current view information
1213
+ * @param viewSize The size of the view area
1214
+ * @param fullscreen Whether it is in fullscreen mode
1215
+ * @param canvasSize The size of the canvas
1216
+ * @param canvasZoom The zoom level of the canvas
1217
+ * @param canvasOffset The offset position of the canvas
1218
+ */
1219
+ export type RGViewInformation = {
1220
+ viewSize: { width: number; height: number },
1221
+ fullscreen: boolean,
1222
+ canvasSize: { width: number; height: number },
1223
+ canvasZoom: number,
1224
+ canvasOffset: { x: number; y: number },
1225
+ showEasyView?: boolean,
1226
+ }
1227
+ /**
1228
+ * Reactive data object returned by hooks provided by the relation-graph component:
1229
+ * - Information about the currently selected node or lines
1230
+ * @param checkedLineId The ID of the selected line
1231
+ * @param checkedNodeId The ID of the selected node
1232
+ * @param draggingNodeId The ID of the node being dragged
1233
+ */
1234
+ export type RGCheckedItem = {
1235
+ checkedLineId?: string;
1236
+ checkedNodeId?: string;
1237
+ draggingNodeId?: string;
1238
+ }
1239
+
1240
+ /**
1241
+ * Enumeration of all event names supported by relation-graph
1242
+ */
1243
+ export enum RGEventNames {
1244
+ onReady = 'onReady',
1245
+ onNodeClick = 'onNodeClick',
1246
+ onNodeExpand = 'onNodeExpand',
1247
+ onNodeCollapse = 'onNodeCollapse',
1248
+ onLineClick = 'onLineClick',
1249
+ onNodeDragStart = 'onNodeDragStart',
1250
+ onNodeDragEnd = 'onNodeDragEnd',
1251
+ onNodeDragging = 'onNodeDragging',
1252
+ onCanvasDragEnd = 'onCanvasDragEnd',
1253
+ onCanvasDragging = 'onCanvasDragging',
1254
+ onContextmenu = 'onContextmenu',
1255
+ onFullscreen = 'onFullscreen',
1256
+ onCanvasClick = 'onCanvasClick',
1257
+ onCanvasSelectionEnd = 'onCanvasSelectionEnd',
1258
+ beforeZoomStart = 'beforeZoomStart',
1259
+ onZoomEnd = 'onZoomEnd',
1260
+ onViewResize = 'onViewResize',
1261
+ onResizeStart = 'onResizeStart',
1262
+ beforeNodeResize = 'beforeNodeResize',
1263
+ onResizeEnd = 'onResizeEnd',
1264
+ onLineVertexDropped = 'onLineVertexDropped',
1265
+ beforeCreateLine = 'beforeCreateLine',
1266
+ onLineBeCreated = 'onLineBeCreated',
1267
+ beforeAddNodes = 'beforeAddNodes',
1268
+ beforeAddLines = 'beforeAddLines',
1269
+ onKeyboardDown = 'onKeyboardDown',
1270
+ onKeyboardUp = 'onKeyboardUp',
1271
+ onCanvasDragStart = 'onCanvasDragStart',
1272
+ onForceLayoutFinish = 'onForceLayoutFinish',
1273
+ beforeScrollStart = 'beforeScrollStart'
1274
+ }
1275
+ /**
1276
+ * All event listener types supported by the relation-graph component
1277
+ */
1278
+ export interface RGListeners {
1279
+ /**
1280
+ * When the graph is ready, this event is triggered
1281
+ * @param graphInstance The relation-graph instance object
1282
+ */
1283
+ onReady?: (graphInstance: RelationGraphInstance) => void;
1284
+ /**
1285
+ * Triggered when a node is clicked
1286
+ */
1287
+ onNodeClick?: (node: RGNode, e: RGUserEvent) => boolean | void | Promise<boolean | void>;
1288
+ /**
1289
+ * Triggered when a node is expanded
1290
+ */
1291
+ onNodeExpand?: (node: RGNode, e: RGUserEvent) => boolean | void | Promise<boolean | void>;
1292
+ /**
1293
+ * Triggered when a node is collapsed
1294
+ */
1295
+ onNodeCollapse?: (node: RGNode, e: RGUserEvent) => boolean | void | Promise<boolean | void>;
1296
+ /**
1297
+ * Triggered when a line is clicked, line is the line, link is the RGLink object corresponding to the line
1298
+ */
1299
+ onLineClick?: (line: RGLine, link: RGLink, e: RGUserEvent) => boolean | void | Promise<boolean | void>;
1300
+ /**
1301
+ * Triggered when a node drag starts
1302
+ * @param node The dragged node
1303
+ */
1304
+ onNodeDragStart?: (node: RGNode, e: RGUserEvent) => void;
1305
+ /**
1306
+ * Triggered when a node drag ends
1307
+ * @param node The dragged node
1308
+ * @param e The event that triggered the drag end
1309
+ * @param x_buff The x offset at the end of the drag
1310
+ * @param y_buff The y offset at the end of the drag
1311
+ *
1312
+ */
1313
+ onNodeDragEnd?: (node: RGNode, e: RGUserEvent, x_buff: number, y_buff: number) => void;
1314
+ /**
1315
+ * Triggered when a node is being dragged
1316
+ * @param node The dragged node
1317
+ * @param newX The new X position of the node
1318
+ * @param newY The new Y position of the node
1319
+ * @param buffX The X offset of the node from the start of the drag to the current position
1320
+ * @param buffY The Y offset of the node from the start of the drag to the current position
1321
+ * @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
1322
+ */
1323
+ onNodeDragging?: (node: RGNode, newX: number, newY: number, buffX: number, buffY: number, e: RGUserEvent) => void | RGPosition | undefined;
1324
+ /**
1325
+ * Triggered when the canvas drag ends
1326
+ */
1327
+ onCanvasDragEnd?: (e: RGUserEvent) => void;
1328
+ /**
1329
+ * Triggered when the canvas is being dragged
1330
+ * @param newX The new offset X of the canvas
1331
+ * @param newY The new offset Y of the canvas
1332
+ * @param buffX The X offset of the canvas from the start of the drag to the current position
1333
+ * @param buffY The Y offset of the canvas from the start of the drag to the current position
1334
+ * @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
1335
+ */
1336
+ onCanvasDragging?: (newX: number, newY: number, buffX: number, buffY: number) => void | RGPosition | undefined;
1337
+ /**
1338
+ * Triggered when the canvas is right-clicked
1339
+ * @param e The event that triggered
1340
+ * @param objectType The type of object, which can be 'canvas', 'node', or 'line'
1341
+ * @param object The clicked object, which can be undefined, RGNode, or RGLine
1342
+ * @param eventPositionOnCanvas The coordinates of the event on the canvas
1343
+ * @param eventPositionOnView The coordinates of the event on the view (relative to the top-left corner of the <RelationGraph> component)
1344
+ */
1345
+ onContextmenu?: (e: RGUserEvent, objectType: RGEventTargetType, object: RGNode | RGLine | undefined, eventPositionOnCanvas: RGCoordinate, eventPositionOnView: RGCoordinate) => void;
1346
+ /**
1347
+ * Triggered when the fullscreen state changes
1348
+ * @param newValue The new fullscreen state
1349
+ * @param defaultFullscreen The function to perform the default fullscreen toggle operation
1350
+ */
1351
+ onFullscreen?: (newValue: boolean, defaultFullscreen: () => Promise<void>) => void;
1352
+ /**
1353
+ * Triggered when the canvas is clicked
1354
+ * - This event will not be triggered when clicking on nodes or lines
1355
+ */
1356
+ onCanvasClick?: (e: RGUserEvent) => void;
1357
+ /**
1358
+ * Triggered when the canvas selection ends
1359
+ * @param selectionView The area information of the canvas selection, including x, y, width, height
1360
+ */
1361
+ onCanvasSelectionEnd?: (selectionView: RGSelectionView, e: RGUserEvent) => void;
1362
+ /**
1363
+ * Triggered before zooming starts
1364
+ * @return Returning false can prevent the zoom operation
1365
+ */
1366
+ beforeZoomStart?: () => void | false;
1367
+ /**
1368
+ * Triggered when zooming ends
1369
+ */
1370
+ onZoomEnd?: () => void;
1371
+ /**
1372
+ * Triggered when the view size changes
1373
+ */
1374
+ onViewResize?: () => void;
1375
+ /**
1376
+ * Triggered when one or more nodes (via RGEditingResize) start being resized
1377
+ * @param nodes The array of nodes being resized
1378
+ */
1379
+ onResizeStart?: (nodes: RGNode[], e: RGUserEvent) => void;
1380
+ /**
1381
+ * Triggered before resizing a node, returning false can prevent the resize operation
1382
+ * @param node The node being resized
1383
+ * @param newX The new X position to be resized to
1384
+ * @param newY The new Y position to be resized to
1385
+ * @param newW The new width to be resized to
1386
+ * @param newH The new height to be resized to
1387
+ * @return Return false to prevent resizing
1388
+ */
1389
+ beforeNodeResize?: (node: RGNode, newX: number, newY: number, newW: number, newH: number) => void | false;
1390
+ /**
1391
+ * Triggered when one or more nodes (via RGEditingResize) finish being resized
1392
+ * @param nodes The array of nodes that were resized
1393
+ * @param buffX The X offset at the end of the resize
1394
+ * @param buffY The Y offset at the end of the resize
1395
+ */
1396
+ onResizeEnd?: (nodes: RGNode[], buffX: number, buffY: number, e: RGUserEvent) => void;
1397
+ /**
1398
+ * Triggered when the endpoint (start or end) of a line is dropped
1399
+ * @param fromNode The starting node
1400
+ * @param toNode The target node
1401
+ * @param lineTemplate The line information (JsonLine)
1402
+ *
1403
+ */
1404
+ onLineVertexDropped?: (lineInfo: {
1405
+ newLineTemplate: JsonLine,
1406
+ fromNode: RGLineTarget | RGNode,
1407
+ toNode: RGLineTarget | RGNode
1408
+ }) => void;
1409
+ /**
1410
+ * 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.
1411
+ * @param fromNode The starting node
1412
+ * @param toNode The target node
1413
+ * @param lineTemplate The line information (JsonLine)
1414
+ *
1415
+ */
1416
+ beforeCreateLine?: (lineInfo: {
1417
+ lineJson: JsonLine,
1418
+ fromNode: RGLineTarget | RGNode,
1419
+ toNode: RGLineTarget | RGNode
1420
+ }) => void | false;
1421
+ /**
1422
+ * Triggered when a new line is created or the endpoint is modified
1423
+ * - 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.
1424
+ * - 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.
1425
+ * @param fromNode The starting node
1426
+ * @param toNode The target node
1427
+ * @param lineTemplate The line information (JsonLine)
1428
+ */
1429
+ onLineBeCreated?: (lineInfo: {
1430
+ lineJson: JsonLine,
1431
+ fromNode: RGLineTarget | RGNode,
1432
+ toNode: RGLineTarget | RGNode
1433
+ }) => void;
1434
+ /**
1435
+ * Triggered before new nodes are added (via setJsonData, addNodes methods) to the graph
1436
+ * @param nodes The array of jsonNode objects that are about to be added
1437
+ */
1438
+ beforeAddNodes?: (nodes: JsonNode[]) => void;
1439
+ /**
1440
+ * Triggered before new lines are added (via setJsonData, addLines methods) to the graph
1441
+ * @param lines The array of jsonLine objects that are about to be added
1442
+ */
1443
+ beforeAddLines?: (lines: JsonLine[]) => void;
1444
+ /**
1445
+ * Triggered when the keyboard is pressed down in the graph area
1446
+ * @param e
1447
+ */
1448
+ onKeyboardDown?: (e: KeyboardEvent) => void;
1449
+ /**
1450
+ * Triggered when the keyboard is released in the graph area
1451
+ * @param e
1452
+ */
1453
+ onKeyboardUp?: (e: KeyboardEvent) => void;
1454
+ /**
1455
+ * Triggered when canvas drag starts
1456
+ * @param canvasMoveStartPosition The initial position of the canvas when dragging starts
1457
+ * @param eventClientStartPosition The client position of the user event when it starts
1458
+ * @param e
1459
+ */
1460
+ onCanvasDragStart?: (canvasMoveStartPosition: RGPosition, eventClientStartPosition: RGPosition, e: RGUserEvent) => void;
1461
+ /**
1462
+ * Triggered when the force-directed layout calculation is completed
1463
+ */
1464
+ onForceLayoutFinish?: () => void;
1465
+ /**
1466
+ * Triggered before performing canvas move scroll, returning true indicates to prevent the scroll from continuing
1467
+ * @param buffX The X offset that is about to be scrolled
1468
+ * @param buffY The Y offset that is about to be scrolled
1469
+ * @return true = Abort Scroll
1470
+ */
1471
+ beforeScrollStart?: (buffX: number, buffY: number, e: Event) => true | undefined | void;
1472
+ }