@relation-graph/vue3 3.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (254) hide show
  1. package/LICENSE +21 -0
  2. package/package.json +65 -0
  3. package/relation-graph.js +284 -0
  4. package/relation-graph.mjs +9626 -0
  5. package/relation-graph.umd.js +284 -0
  6. package/types/components.d.ts +5 -0
  7. package/types/packages/platforms/react/src/constants.d.ts +1 -0
  8. package/types/packages/platforms/react/src/index.d.ts +224 -0
  9. package/types/packages/platforms/react/src/relation-graph/RGProvider.d.ts +4 -0
  10. package/types/packages/platforms/react/src/relation-graph/RelationGraph.d.ts +9 -0
  11. package/types/packages/platforms/react/src/relation-graph/RelationLinker.d.ts +4 -0
  12. package/types/packages/platforms/react/src/relation-graph/src/core4react/RGCanvas.d.ts +13 -0
  13. package/types/packages/platforms/react/src/relation-graph/src/core4react/RGCanvasContent.d.ts +18 -0
  14. package/types/packages/platforms/react/src/relation-graph/src/core4react/RGCanvasContent4CreatingLine.d.ts +10 -0
  15. package/types/packages/platforms/react/src/relation-graph/src/core4react/RGCanvasContent4FakeLines.d.ts +11 -0
  16. package/types/packages/platforms/react/src/relation-graph/src/core4react/RGCanvasContent4Lines.d.ts +12 -0
  17. package/types/packages/platforms/react/src/relation-graph/src/core4react/RGCanvasContent4Nodes.d.ts +13 -0
  18. package/types/packages/platforms/react/src/relation-graph/src/core4react/RGEasyView.d.ts +4 -0
  19. package/types/packages/platforms/react/src/relation-graph/src/core4react/RGFakeNode.d.ts +6 -0
  20. package/types/packages/platforms/react/src/relation-graph/src/core4react/RGGraphRefs.d.ts +5 -0
  21. package/types/packages/platforms/react/src/relation-graph/src/core4react/RGLineContent.d.ts +4 -0
  22. package/types/packages/platforms/react/src/relation-graph/src/core4react/RGLinePath.d.ts +7 -0
  23. package/types/packages/platforms/react/src/relation-graph/src/core4react/RGLinePeel.d.ts +6 -0
  24. package/types/packages/platforms/react/src/relation-graph/src/core4react/RGLineText.d.ts +6 -0
  25. package/types/packages/platforms/react/src/relation-graph/src/core4react/RGNodeExpandHolder.d.ts +4 -0
  26. package/types/packages/platforms/react/src/relation-graph/src/core4react/RGNodePeel.d.ts +13 -0
  27. package/types/packages/platforms/react/src/relation-graph/src/core4react/RelationGraphUI.d.ts +4 -0
  28. package/types/packages/platforms/react/src/relation-graph/src/core4react/RelationGraphView.d.ts +4 -0
  29. package/types/packages/platforms/react/src/relation-graph/src/core4react/RelationLinkerCanvas.d.ts +7 -0
  30. package/types/packages/platforms/react/src/relation-graph/src/core4react/RelationLinkerUI.d.ts +4 -0
  31. package/types/packages/platforms/react/src/relation-graph/src/core4react/RelationLinkerView.d.ts +4 -0
  32. package/types/packages/platforms/react/src/relation-graph/src/core4react/editing/RGConnectSource.d.ts +4 -0
  33. package/types/packages/platforms/react/src/relation-graph/src/core4react/editing/RGConnectTarget.d.ts +4 -0
  34. package/types/packages/platforms/react/src/relation-graph/src/core4react/editing/RGEditingConnectController.d.ts +3 -0
  35. package/types/packages/platforms/react/src/relation-graph/src/core4react/editing/RGEditingConnectPoints.d.ts +7 -0
  36. package/types/packages/platforms/react/src/relation-graph/src/core4react/editing/RGEditingLineController.d.ts +4 -0
  37. package/types/packages/platforms/react/src/relation-graph/src/core4react/editing/RGEditingNearNodeWidget.d.ts +4 -0
  38. package/types/packages/platforms/react/src/relation-graph/src/core4react/editing/RGEditingNodeController.d.ts +3 -0
  39. package/types/packages/platforms/react/src/relation-graph/src/core4react/editing/RGEditingReferenceLine.d.ts +6 -0
  40. package/types/packages/platforms/react/src/relation-graph/src/core4react/editing/RGEditingResize.d.ts +7 -0
  41. package/types/packages/platforms/react/src/relation-graph/src/core4react/editing/RGMiniView.d.ts +4 -0
  42. package/types/packages/platforms/react/src/relation-graph/src/core4react/slots/RGSlotOnCanvas.d.ts +3 -0
  43. package/types/packages/platforms/react/src/relation-graph/src/core4react/slots/RGSlotOnCanvasAbove.d.ts +3 -0
  44. package/types/packages/platforms/react/src/relation-graph/src/core4react/slots/RGSlotOnLine.d.ts +6 -0
  45. package/types/packages/platforms/react/src/relation-graph/src/core4react/slots/RGSlotOnLineText.d.ts +6 -0
  46. package/types/packages/platforms/react/src/relation-graph/src/core4react/slots/RGSlotOnNode.d.ts +6 -0
  47. package/types/packages/platforms/react/src/relation-graph/src/core4react/slots/RGSlotOnNodeExpandHandle.d.ts +3 -0
  48. package/types/packages/platforms/react/src/relation-graph/src/core4react/slots/RGSlotOnView.d.ts +3 -0
  49. package/types/packages/platforms/react/src/relation-graph/src/core4react/store/index.d.ts +4 -0
  50. package/types/packages/platforms/react/src/relation-graph/src/core4react/store/reducers/RGStore.d.ts +10 -0
  51. package/types/packages/platforms/react/src/relation-graph/src/core4react/widgets/GraphBackground.d.ts +4 -0
  52. package/types/packages/platforms/react/src/relation-graph/src/core4react/widgets/GraphLoading.d.ts +3 -0
  53. package/types/packages/platforms/react/src/relation-graph/src/core4react/widgets/GraphMoveOperator.d.ts +3 -0
  54. package/types/packages/platforms/react/src/relation-graph/src/core4react/widgets/GraphOperateStuff.d.ts +7 -0
  55. package/types/packages/platforms/react/src/relation-graph/src/core4react/widgets/GraphToolBar.d.ts +4 -0
  56. package/types/packages/platforms/react/src/relation-graph/src/core4react/widgets/GraphWatermark.d.ts +4 -0
  57. package/types/packages/platforms/react/src/relation-graph/src/core4react/widgets/GraphXsToolBar.d.ts +4 -0
  58. package/types/packages/platforms/react/src/relation-graph/src/core4react/widgets/RGDebugView.d.ts +3 -0
  59. package/types/packages/platforms/react/src/relation-graph/src/core4react/widgets/RGIcons.d.ts +6 -0
  60. package/types/packages/platforms/react/src/relation-graph/src/hooks/RGDataProvider.d.ts +17 -0
  61. package/types/packages/platforms/react/src/relation-graph/src/hooks/RGHooks.d.ts +30 -0
  62. package/types/packages/platforms/react/src/relation-graph/src/hooks/useFakeNodesState.d.ts +8 -0
  63. package/types/packages/platforms/react/src/relation-graph/src/hooks/useGraphInstance.d.ts +3 -0
  64. package/types/packages/platforms/react/src/relation-graph/src/hooks/useGraphStore.d.ts +13 -0
  65. package/types/packages/platforms/react/src/relation-graph/src/hooks/useRelationGraph.d.ts +11 -0
  66. package/types/packages/platforms/react/src/relation-graph/src/hooks/useRelationLinker.d.ts +17 -0
  67. package/types/packages/platforms/react/src/types-react.d.ts +35 -0
  68. package/types/packages/platforms/svelte/src/RGProvider.svelte.d.ts +1 -0
  69. package/types/packages/platforms/svelte/src/context.d.ts +4 -0
  70. package/types/packages/platforms/svelte/src/core4svelte/RGCanvas.svelte.d.ts +1 -0
  71. package/types/packages/platforms/svelte/src/core4svelte/RGCanvasContent.svelte.d.ts +1 -0
  72. package/types/packages/platforms/svelte/src/core4svelte/RGCanvasContent4CreatingLine.svelte.d.ts +1 -0
  73. package/types/packages/platforms/svelte/src/core4svelte/RGCanvasContent4FakeLines.svelte.d.ts +1 -0
  74. package/types/packages/platforms/svelte/src/core4svelte/RGCanvasContent4Lines.svelte.d.ts +1 -0
  75. package/types/packages/platforms/svelte/src/core4svelte/RGCanvasContent4Nodes.svelte.d.ts +1 -0
  76. package/types/packages/platforms/svelte/src/core4svelte/RGEasyView.svelte.d.ts +1 -0
  77. package/types/packages/platforms/svelte/src/core4svelte/RGFakeNode.svelte.d.ts +1 -0
  78. package/types/packages/platforms/svelte/src/core4svelte/RGGraphDefs.svelte.d.ts +1 -0
  79. package/types/packages/platforms/svelte/src/core4svelte/RGLineContent.svelte.d.ts +1 -0
  80. package/types/packages/platforms/svelte/src/core4svelte/RGLinePath.svelte.d.ts +1 -0
  81. package/types/packages/platforms/svelte/src/core4svelte/RGLinePeel.svelte.d.ts +1 -0
  82. package/types/packages/platforms/svelte/src/core4svelte/RGLineText.svelte.d.ts +1 -0
  83. package/types/packages/platforms/svelte/src/core4svelte/RGNodeExpandHolder.svelte.d.ts +1 -0
  84. package/types/packages/platforms/svelte/src/core4svelte/RGNodePeel.svelte.d.ts +1 -0
  85. package/types/packages/platforms/svelte/src/core4svelte/RGProvider4Instance.svelte.d.ts +1 -0
  86. package/types/packages/platforms/svelte/src/core4svelte/RelationGraph.svelte.d.ts +1 -0
  87. package/types/packages/platforms/svelte/src/core4svelte/RelationGraphUI.svelte.d.ts +1 -0
  88. package/types/packages/platforms/svelte/src/core4svelte/RelationGraphWithProvider.svelte.d.ts +1 -0
  89. package/types/packages/platforms/svelte/src/core4svelte/RelationLinker.svelte.d.ts +1 -0
  90. package/types/packages/platforms/svelte/src/core4svelte/RelationLinkerCanvas.svelte.d.ts +1 -0
  91. package/types/packages/platforms/svelte/src/core4svelte/RelationLinkerUI.svelte.d.ts +1 -0
  92. package/types/packages/platforms/svelte/src/core4svelte/editing/RGConnectSource.svelte.d.ts +1 -0
  93. package/types/packages/platforms/svelte/src/core4svelte/editing/RGConnectTarget.svelte.d.ts +1 -0
  94. package/types/packages/platforms/svelte/src/core4svelte/editing/RGConnectTargetUI.svelte.d.ts +1 -0
  95. package/types/packages/platforms/svelte/src/core4svelte/editing/RGEditingConnectController.svelte.d.ts +1 -0
  96. package/types/packages/platforms/svelte/src/core4svelte/editing/RGEditingConnectPoints.svelte.d.ts +1 -0
  97. package/types/packages/platforms/svelte/src/core4svelte/editing/RGEditingLineController.svelte.d.ts +1 -0
  98. package/types/packages/platforms/svelte/src/core4svelte/editing/RGEditingLineControllerUI.svelte.d.ts +1 -0
  99. package/types/packages/platforms/svelte/src/core4svelte/editing/RGEditingNearNodeWidget.svelte.d.ts +1 -0
  100. package/types/packages/platforms/svelte/src/core4svelte/editing/RGEditingNodeController.svelte.d.ts +1 -0
  101. package/types/packages/platforms/svelte/src/core4svelte/editing/RGEditingNodeControllerUI.svelte.d.ts +1 -0
  102. package/types/packages/platforms/svelte/src/core4svelte/editing/RGEditingReferenceLine.svelte.d.ts +1 -0
  103. package/types/packages/platforms/svelte/src/core4svelte/editing/RGEditingResize.svelte.d.ts +1 -0
  104. package/types/packages/platforms/svelte/src/core4svelte/editing/RGEditingResizeUI.svelte.d.ts +1 -0
  105. package/types/packages/platforms/svelte/src/core4svelte/editing/RGMiniView.svelte.d.ts +1 -0
  106. package/types/packages/platforms/svelte/src/core4svelte/editing/RGMiniViewContent.svelte.d.ts +1 -0
  107. package/types/packages/platforms/svelte/src/core4svelte/web-components/RGConnectTarget.svelte.d.ts +1 -0
  108. package/types/packages/platforms/svelte/src/core4svelte/web-components/RGEditingConnectController.svelte.d.ts +1 -0
  109. package/types/packages/platforms/svelte/src/core4svelte/web-components/RGEditingLineController.svelte.d.ts +1 -0
  110. package/types/packages/platforms/svelte/src/core4svelte/web-components/RGEditingNearNodeWidget.svelte.d.ts +1 -0
  111. package/types/packages/platforms/svelte/src/core4svelte/web-components/RGEditingNodeController.svelte.d.ts +1 -0
  112. package/types/packages/platforms/svelte/src/core4svelte/web-components/RGEditingReferenceLine.svelte.d.ts +1 -0
  113. package/types/packages/platforms/svelte/src/core4svelte/web-components/RGEditingResize.svelte.d.ts +1 -0
  114. package/types/packages/platforms/svelte/src/core4svelte/web-components/RGMiniView.svelte.d.ts +1 -0
  115. package/types/packages/platforms/svelte/src/core4svelte/web-components/RelationGraphWithProvider.svelte.d.ts +1 -0
  116. package/types/packages/platforms/svelte/src/core4svelte/web-components/WebComponentUtils.d.ts +11 -0
  117. package/types/packages/platforms/svelte/src/core4svelte/widgets/GraphBackground.svelte.d.ts +1 -0
  118. package/types/packages/platforms/svelte/src/core4svelte/widgets/GraphLoading.svelte.d.ts +1 -0
  119. package/types/packages/platforms/svelte/src/core4svelte/widgets/GraphMoveOperator.svelte.d.ts +1 -0
  120. package/types/packages/platforms/svelte/src/core4svelte/widgets/GraphOperateStuff.svelte.d.ts +1 -0
  121. package/types/packages/platforms/svelte/src/core4svelte/widgets/GraphWatermark.svelte.d.ts +1 -0
  122. package/types/packages/platforms/svelte/src/core4svelte/widgets/GraphXsToolBar.svelte.d.ts +1 -0
  123. package/types/packages/platforms/svelte/src/core4svelte/widgets/RGIcons.svelte.d.ts +1 -0
  124. package/types/packages/platforms/svelte/src/hooks/RGHooks.d.ts +27 -0
  125. package/types/packages/platforms/svelte/src/hooks/useGraphInstance.d.ts +2 -0
  126. package/types/packages/platforms/svelte/src/hooks/useGraphStore.d.ts +14 -0
  127. package/types/packages/platforms/svelte/src/hooks/useRGDataProvider.d.ts +19 -0
  128. package/types/packages/platforms/svelte/src/hooks/useRelationGraph.d.ts +48 -0
  129. package/types/packages/platforms/svelte/src/index.d.ts +194 -0
  130. package/types/packages/platforms/svelte/src/types-svelte.d.ts +85 -0
  131. package/types/packages/platforms/vue2/src/core4vue/RGCanvas.vue.d.ts +9 -0
  132. package/types/packages/platforms/vue2/src/core4vue/RGCanvasContent.vue.d.ts +10 -0
  133. package/types/packages/platforms/vue2/src/core4vue/RGCanvasContent4CreatingLine.vue.d.ts +9 -0
  134. package/types/packages/platforms/vue2/src/core4vue/RGCanvasContent4FakeLines.vue.d.ts +9 -0
  135. package/types/packages/platforms/vue2/src/core4vue/RGCanvasContent4Lines.vue.d.ts +9 -0
  136. package/types/packages/platforms/vue2/src/core4vue/RGCanvasContent4Nodes.vue.d.ts +9 -0
  137. package/types/packages/platforms/vue2/src/core4vue/RGEasyView.vue.d.ts +7 -0
  138. package/types/packages/platforms/vue2/src/core4vue/RGFakeNode.vue.d.ts +18 -0
  139. package/types/packages/platforms/vue2/src/core4vue/RGGraphDefs.vue.d.ts +19 -0
  140. package/types/packages/platforms/vue2/src/core4vue/RGLineContent.vue.d.ts +23 -0
  141. package/types/packages/platforms/vue2/src/core4vue/RGLinePath.vue.d.ts +14 -0
  142. package/types/packages/platforms/vue2/src/core4vue/RGLinePeel.vue.d.ts +9 -0
  143. package/types/packages/platforms/vue2/src/core4vue/RGNodeExpandHolder.vue.d.ts +30 -0
  144. package/types/packages/platforms/vue2/src/core4vue/RGNodePeel.vue.d.ts +17 -0
  145. package/types/packages/platforms/vue2/src/core4vue/RGProvider.vue.d.ts +50 -0
  146. package/types/packages/platforms/vue2/src/core4vue/RelationGraph.vue.d.ts +52 -0
  147. package/types/packages/platforms/vue2/src/core4vue/RelationGraphUI.vue.d.ts +46 -0
  148. package/types/packages/platforms/vue2/src/core4vue/RelationLinker.vue.d.ts +46 -0
  149. package/types/packages/platforms/vue2/src/core4vue/RelationLinkerCanvas.vue.d.ts +12 -0
  150. package/types/packages/platforms/vue2/src/core4vue/RelationLinkerUI.vue.d.ts +23 -0
  151. package/types/packages/platforms/vue2/src/core4vue/editing/RGConnectSource.vue.d.ts +31 -0
  152. package/types/packages/platforms/vue2/src/core4vue/editing/RGConnectTarget.vue.d.ts +85 -0
  153. package/types/packages/platforms/vue2/src/core4vue/editing/RGEditingConnectController.vue.d.ts +9 -0
  154. package/types/packages/platforms/vue2/src/core4vue/editing/RGEditingConnectPoints.vue.d.ts +25 -0
  155. package/types/packages/platforms/vue2/src/core4vue/editing/RGEditingLineController.vue.d.ts +43 -0
  156. package/types/packages/platforms/vue2/src/core4vue/editing/RGEditingNearNodeWidget.vue.d.ts +21 -0
  157. package/types/packages/platforms/vue2/src/core4vue/editing/RGEditingNodeController.vue.d.ts +5 -0
  158. package/types/packages/platforms/vue2/src/core4vue/editing/RGEditingReferenceLine.vue.d.ts +30 -0
  159. package/types/packages/platforms/vue2/src/core4vue/editing/RGEditingResize.vue.d.ts +32 -0
  160. package/types/packages/platforms/vue2/src/core4vue/editing/RGMiniView.vue.d.ts +40 -0
  161. package/types/packages/platforms/vue2/src/core4vue/widgets/GraphBackground.vue.d.ts +33 -0
  162. package/types/packages/platforms/vue2/src/core4vue/widgets/GraphLoading.vue.d.ts +5 -0
  163. package/types/packages/platforms/vue2/src/core4vue/widgets/GraphMoveOperator.vue.d.ts +8 -0
  164. package/types/packages/platforms/vue2/src/core4vue/widgets/GraphOperateStuff.vue.d.ts +5 -0
  165. package/types/packages/platforms/vue2/src/core4vue/widgets/GraphToolBar.vue.d.ts +46 -0
  166. package/types/packages/platforms/vue2/src/core4vue/widgets/GraphWatermark.vue.d.ts +58 -0
  167. package/types/packages/platforms/vue2/src/core4vue/widgets/GraphXsToolBar.vue.d.ts +46 -0
  168. package/types/packages/platforms/vue2/src/core4vue/widgets/RGDebugView.vue.d.ts +12 -0
  169. package/types/packages/platforms/vue2/src/hooks/GraphStoreMixin.d.ts +40 -0
  170. package/types/packages/platforms/vue2/src/index.d.ts +944 -0
  171. package/types/packages/platforms/vue2/src/types-vue2.d.ts +3 -0
  172. package/types/packages/platforms/vue2/vite.config.d.ts +2 -0
  173. package/types/packages/platforms/vue3/src/constants.d.ts +3 -0
  174. package/types/packages/platforms/vue3/src/index.d.ts +188 -0
  175. package/types/packages/platforms/vue3/src/relation-graph/src/hooks/RGHooks.d.ts +32 -0
  176. package/types/packages/platforms/vue3/src/relation-graph/src/hooks/useGraphData.d.ts +2 -0
  177. package/types/packages/platforms/vue3/src/relation-graph/src/hooks/useGraphInstance.d.ts +2 -0
  178. package/types/packages/platforms/vue3/src/relation-graph/src/hooks/useGraphStore.d.ts +16 -0
  179. package/types/packages/platforms/vue3/src/relation-graph/src/hooks/useRGDataProvider.d.ts +17 -0
  180. package/types/packages/platforms/vue3/src/relation-graph/src/hooks/useRelationGraph.d.ts +131 -0
  181. package/types/packages/platforms/vue3/src/relation-graph/src/hooks/useRelationLinker.d.ts +39 -0
  182. package/types/packages/platforms/vue3/src/types-vue3.d.ts +122 -0
  183. package/types/packages/platforms/vue3/src/types.d.ts +3 -0
  184. package/types/packages/platforms/vue3/vite.config.d.ts +2 -0
  185. package/types/packages/relation-graph-models/RGObjectsForExport.d.ts +140 -0
  186. package/types/packages/relation-graph-models/constants.d.ts +1 -0
  187. package/types/packages/relation-graph-models/data/RGDataDefine.d.ts +23 -0
  188. package/types/packages/relation-graph-models/data/RGDataGetter.d.ts +36 -0
  189. package/types/packages/relation-graph-models/data/RGDataProvider.d.ts +66 -0
  190. package/types/packages/relation-graph-models/data/RGDataProvider4React.d.ts +9 -0
  191. package/types/packages/relation-graph-models/data/RGDataProvider4Svelte.d.ts +10 -0
  192. package/types/packages/relation-graph-models/data/RGDataProvider4Vue2.d.ts +9 -0
  193. package/types/packages/relation-graph-models/data/RGDataProvider4Vue3.d.ts +10 -0
  194. package/types/packages/relation-graph-models/data/RGDataProvider4Vue3V1.d.ts +10 -0
  195. package/types/packages/relation-graph-models/data/RGLineDataUtils.d.ts +9 -0
  196. package/types/packages/relation-graph-models/data/RGNodeDataUtils.d.ts +17 -0
  197. package/types/packages/relation-graph-models/data/RGOptionsDataUtils.d.ts +7 -0
  198. package/types/packages/relation-graph-models/data/utils/EdgeCounter.d.ts +8 -0
  199. package/types/packages/relation-graph-models/layouts/RGBaseLayout.d.ts +37 -0
  200. package/types/packages/relation-graph-models/layouts/RGCenterLayout.d.ts +9 -0
  201. package/types/packages/relation-graph-models/layouts/RGCircleLayout.d.ts +7 -0
  202. package/types/packages/relation-graph-models/layouts/RGFixedLayout.d.ts +10 -0
  203. package/types/packages/relation-graph-models/layouts/RGFolderLayout.d.ts +15 -0
  204. package/types/packages/relation-graph-models/layouts/RGForceLayout.d.ts +82 -0
  205. package/types/packages/relation-graph-models/layouts/RGIOTreeLayout.d.ts +18 -0
  206. package/types/packages/relation-graph-models/layouts/RGSmartTreeLayout.d.ts +14 -0
  207. package/types/packages/relation-graph-models/layouts/RGTreeLayout.d.ts +17 -0
  208. package/types/packages/relation-graph-models/layouts/analyzers/BasicNetworkAnalyzer.d.ts +28 -0
  209. package/types/packages/relation-graph-models/layouts/analyzers/RGNetworkAnalyzer.d.ts +27 -0
  210. package/types/packages/relation-graph-models/layouts/tmp/old.d.ts +1 -0
  211. package/types/packages/relation-graph-models/models/RelationGraphBase.d.ts +80 -0
  212. package/types/packages/relation-graph-models/models/RelationGraphCore.d.ts +46 -0
  213. package/types/packages/relation-graph-models/models/RelationGraphWith1View.d.ts +96 -0
  214. package/types/packages/relation-graph-models/models/RelationGraphWith2Data.d.ts +53 -0
  215. package/types/packages/relation-graph-models/models/RelationGraphWith2Data1Getter.d.ts +85 -0
  216. package/types/packages/relation-graph-models/models/RelationGraphWith2Data2Analysis.d.ts +177 -0
  217. package/types/packages/relation-graph-models/models/RelationGraphWith2Data3Update.d.ts +259 -0
  218. package/types/packages/relation-graph-models/models/RelationGraphWith2Data4ConnectTarget.d.ts +85 -0
  219. package/types/packages/relation-graph-models/models/RelationGraphWith2Data5LineConfig.d.ts +35 -0
  220. package/types/packages/relation-graph-models/models/RelationGraphWith3Options1Update.d.ts +75 -0
  221. package/types/packages/relation-graph-models/models/RelationGraphWith3Options2API.d.ts +39 -0
  222. package/types/packages/relation-graph-models/models/RelationGraphWith4Line.d.ts +112 -0
  223. package/types/packages/relation-graph-models/models/RelationGraphWith5Zoom.d.ts +29 -0
  224. package/types/packages/relation-graph-models/models/RelationGraphWith6Effect.d.ts +72 -0
  225. package/types/packages/relation-graph-models/models/RelationGraphWith6Layout.d.ts +85 -0
  226. package/types/packages/relation-graph-models/models/RelationGraphWith7Event.d.ts +270 -0
  227. package/types/packages/relation-graph-models/models/RelationGraphWith91Editing.d.ts +210 -0
  228. package/types/packages/relation-graph-models/models/RelationGraphWith92MiniView.d.ts +107 -0
  229. package/types/packages/relation-graph-models/models/RelationGraphWith93Image.d.ts +38 -0
  230. package/types/packages/relation-graph-models/models/RelationGraphWith93Image_codes.d.ts +36 -0
  231. package/types/packages/relation-graph-models/models/RelationGraphWith95Dom.d.ts +112 -0
  232. package/types/packages/relation-graph-models/models/RelationGraphWith99API.d.ts +125 -0
  233. package/types/packages/relation-graph-models/models/RelationGraphWith9EasyView.d.ts +74 -0
  234. package/types/packages/relation-graph-models/utils/RGCanvasImpl2D.d.ts +58 -0
  235. package/types/packages/relation-graph-models/utils/RGCanvasImplWebGL.d.ts +47 -0
  236. package/types/packages/relation-graph-models/utils/RGCommon.d.ts +31 -0
  237. package/types/packages/relation-graph-models/utils/RGDragUtils.d.ts +20 -0
  238. package/types/packages/relation-graph-models/utils/RGFullscreenUtils.d.ts +3 -0
  239. package/types/packages/relation-graph-models/utils/RGGraphMath.d.ts +131 -0
  240. package/types/packages/relation-graph-models/utils/RGIconsData.d.ts +41 -0
  241. package/types/packages/relation-graph-models/utils/RGIntergration.d.ts +45 -0
  242. package/types/packages/relation-graph-models/utils/RGNodesAnalytic.d.ts +29 -0
  243. package/types/packages/relation-graph-models/utils/RGTips.d.ts +7 -0
  244. package/types/packages/relation-graph-models/utils/line/RGLinePath.d.ts +105 -0
  245. package/types/packages/relation-graph-models/utils/line/RGLinePathUtils.d.ts +54 -0
  246. package/types/packages/relation-graph-models/utils/line/RGPathGeneratorFor1.d.ts +2 -0
  247. package/types/packages/relation-graph-models/utils/line/RGPathGeneratorFor4.d.ts +2 -0
  248. package/types/packages/relation-graph-models/utils/line/RGPathGeneratorFor44.d.ts +2 -0
  249. package/types/packages/relation-graph-models/utils/line/RGPathGeneratorFor49.d.ts +2 -0
  250. package/types/packages/relation-graph-models/utils/line/RGPathGeneratorFor6.d.ts +6 -0
  251. package/types/packages/relation-graph-models/utils/line/RGPathGeneratorFor8.d.ts +2 -0
  252. package/types/packages/relation-graph-models/utils/line/RGPathGeneratorForCurve.d.ts +2 -0
  253. package/types/packages/types.d.ts +1467 -0
  254. package/types/packages/types.ts +1480 -0
@@ -0,0 +1,1480 @@
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 RGConnectTargetData = {
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
+ data: Record<string, any>
251
+ lot: {
252
+ childs: RGNode[]
253
+ parent?: RGNode | undefined
254
+ eached?: boolean
255
+ strength?: number
256
+ subling?: {
257
+ level: number
258
+ all_size: number
259
+ all_strength: number
260
+ }
261
+ level?: number
262
+ index_of_parent?: number
263
+ strength_of_level?: number
264
+ index_of_level?: number
265
+ childrenSize?: number
266
+ childrenSizeVisible?: number
267
+ index_of_p_childs?: number
268
+ strengthWithChilds?: number
269
+ strengthWithChilds_from?: number
270
+ x?: number
271
+ y?: number
272
+ }
273
+ rgChildrenSize: number
274
+ rgShouldRender: boolean
275
+ rgCalcedVisibility: boolean
276
+ }
277
+ /**
278
+ * JSON line type for relation-graph
279
+ * @example
280
+ * ```ts
281
+ * import {JsonLine, RGLineShape} from 'relation-graph-react';
282
+ * const line: JsonLine = {
283
+ * id: 'line1',
284
+ * from: 'node1',
285
+ * to: 'node2',
286
+ * text: 'Line from Node 1 to Node 2',
287
+ * type: 'customLineType',
288
+ * color: '#0000ff',
289
+ * lineShape: RGLineShape.StandardCurve,
290
+ * data: {
291
+ * customProperty: 'customValue'
292
+ * }
293
+ * };
294
+ * ```
295
+ */
296
+ export type JsonLine = {
297
+ id: string
298
+ from: string
299
+ to: string
300
+ text?: string
301
+ selected?: boolean
302
+ type?: string;
303
+ isFakeLine?: boolean;
304
+ fromType?: string;
305
+ toType?: string;
306
+ color?: string
307
+ fontColor?: string
308
+ fontSize?: number
309
+ lineWidth?: number
310
+ opacity?: number
311
+ lineShape?: RGLineShape
312
+ className?: string
313
+ showStartArrow?: boolean
314
+ showEndArrow?: boolean
315
+ startMarkerId?: string
316
+ endMarkerId?: string
317
+ useTextOnPath?: boolean
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
+ textOffsetX?: number
327
+ textOffsetY?: number
328
+ animation?: number
329
+ dashType?: number
330
+ lineRadius?: number
331
+ forDisplayOnly?: boolean
332
+ junctionOffset?: number
333
+ fromJunctionPoint?: RGJunctionPoint
334
+ toJunctionPoint?: RGJunctionPoint
335
+ fromJunctionPointOffsetX?: number
336
+ fromJunctionPointOffsetY?: number
337
+ toJunctionPointOffsetX?: number
338
+ toJunctionPointOffsetY?: 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?: JsonLine[]
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
+ rotate?: number;
486
+ };
487
+ /**
488
+ * Force-directed layout options type
489
+ * - 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.
490
+ * - 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.
491
+ * - byNode: Whether to enable repulsion calculation between nodes, default is true.
492
+ * - byLine: Whether to enable elastic force calculation between lines, default is true.
493
+ * - 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.
494
+ * - 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.
495
+ *
496
+ */
497
+ export type RGForceLayoutOptions = RGLayoutOptionsCore & {
498
+ fastStart?: boolean;
499
+ maxLayoutTimes?: number;
500
+ byNode?: boolean;
501
+ byLine?: boolean;
502
+ force_node_repulsion?: number;
503
+ force_line_elastic?: number;
504
+ };
505
+ /**
506
+ * Center layout options type
507
+ * - distanceCoefficient: 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.
508
+ * - 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.
509
+ * - levelGaps: 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.
510
+ */
511
+ export type RGCenterLayoutOptions = RGForceLayoutOptions & {
512
+ distanceCoefficient?: number
513
+ levelGaps?: number[]
514
+ disableAsForceLayout?: boolean;
515
+ };
516
+ /**
517
+ * Tree layout options type
518
+ * - from: The node ID from which the tree layout starts
519
+ * - treeNodeGapH: Horizontal gap between tree nodes, default is 50
520
+ * - treeNodeGapV: Vertical gap between tree nodes, default is 50
521
+ * - 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.
522
+ * - 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
523
+ * - 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.
524
+ * - 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.
525
+ * - 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'.
526
+ * - 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'.
527
+ */
528
+ export type RGTreeLayoutOptions = RGLayoutOptionsCore & {
529
+ from?: 'left'|'top'|'right'|'bottom'
530
+ treeNodeGapH?: number
531
+ treeNodeGapV?: number
532
+ levelGaps?: number[]
533
+ layoutExpansionDirection?: 'start' | 'center' | 'end'
534
+ simpleTree?: boolean;
535
+ ignoreNodeSize?: boolean;
536
+ alignParentItemsX?: 'start' | 'center' | 'end';
537
+ alignParentItemsY?: 'start' | 'center' | 'end';
538
+ };
539
+ /**
540
+ * Layout options type for relation-graph
541
+ * Supported layoutName include:
542
+ * - tree: Tree layout, using RGTreeLayout class for layout
543
+ * - center: Center layout, using RGCenterLayout class for layout
544
+ * - circle: Circle layout, using RGCircleLayout class for layout
545
+ * - force: Force-directed layout, using RGForceLayout class for layout
546
+ * - fixed: Fixed layout, using RGFixedLayout class for layout
547
+ * - smart-tree: Smart tree layout, using RGSmartTreeLayout class for layout
548
+ * - io-tree: Input-output tree layout, using RGIOTreeLayout class for layout
549
+ * - folder: Folder layout, using RGFolderLayout class for layout
550
+ */
551
+ export type RGLayoutOptions =
552
+ (RGCenterLayoutOptions & { layoutName: 'center' })
553
+ | (RGForceLayoutOptions & { layoutName: 'force' })
554
+ | (RGTreeLayoutOptions & { layoutName: 'tree' })
555
+ | (RGLayoutOptionsCore & { layoutName: 'circle' })
556
+ | (RGLayoutOptionsCore & { layoutName: 'fixed' })
557
+ | (RGTreeLayoutOptions & { layoutName: 'smart-tree' })
558
+ | (RGTreeLayoutOptions & { layoutName: 'io-tree' })
559
+ | (RGTreeLayoutOptions & { layoutName: 'folder' })
560
+
561
+ /**
562
+ * Layout engine interface type for relation-graph internal use
563
+ * @inner
564
+ */
565
+ export interface RGLayout {
566
+ isMainLayouer: boolean
567
+ requireLinks: boolean
568
+ allNodes: RGNode[]
569
+ rootNode?: RGNode
570
+ layoutOptions: RGLayoutOptions
571
+ networkAnalyzer: RGNetworkAnalyzer
572
+ setLinks: (links: RGLink[]) => void
573
+ placeNodes: (allNodes: RGNode[], rootNode: RGNode) => void
574
+ start?: () => void
575
+ stop?: () => void
576
+ }
577
+
578
+ /**
579
+ * Complete configuration type that includes all options available for users to configure
580
+ */
581
+ export type RGOptionsInited = {
582
+ instanceId: string
583
+ debug: boolean
584
+ showToolBar: boolean
585
+ backgroundColor: string
586
+ disableWheelEvent: boolean
587
+ wheelEventAction: 'zoom' | 'scroll' | 'none'
588
+ dragEventAction: 'move' | 'selection' | 'none'
589
+ disableDragNode: boolean
590
+ disableDragLine: boolean
591
+ canvasMoveMode: boolean
592
+ disableNodePointEvent: boolean
593
+ disableLinePointEvent: boolean
594
+ toolBarDirection: 'h'|'v'
595
+ toolBarPositionH: 'left'|'center'|'right'
596
+ toolBarPositionV: 'top'|'center'|'bottom'
597
+ defaultExpandHolderPosition: 'hide' | 'left' | 'top' | 'right' | 'bottom'
598
+ defaultNodeColor: string
599
+ defaultNodeBorderColor: string,
600
+ defaultNodeBorderWidth: number,
601
+ defaultNodeBorderRadius: number,
602
+ defaultNodeShape: RGNodeShape,
603
+ defaultNodeWidth?: number
604
+ defaultNodeHeight?: number
605
+ checkedItemBackgroundColor?: string //
606
+ defaultLineTextOffsetX?: number,
607
+ defaultLineTextOffsetY?: number,
608
+ defaultLineColor: string
609
+ defaultLineWidth: number
610
+ defaultLineShape?: RGLineShape
611
+ // defaultShowLineLabel: boolean
612
+ // hideNodeContentByZoom: boolean
613
+ defaultJunctionPoint?: RGJunctionPoint
614
+ defaultLineJunctionOffset: number,
615
+ // placeSingleNode: boolean
616
+ placeOtherNodes: boolean
617
+ defaultLineTextOnPath: boolean
618
+ lineTextMaxLength: number
619
+ multiLineDistance: number
620
+ checkedNodeId: string // private
621
+ checkedLineId: string // private
622
+ draggingNodeId: string // private
623
+ performanceMode: boolean,
624
+ fullscreenElementXPath: string,
625
+ data: any
626
+ viewHeight: string
627
+ defaultLineMarker: {
628
+ markerWidth: number
629
+ markerHeight: number
630
+ refX: number
631
+ refY: number
632
+ viewBox: string
633
+ data: string
634
+ }
635
+ layout: RGLayoutOptions
636
+ canvasZoom: number // private
637
+ mouseWheelSpeed: number // private
638
+ minCanvasZoom: number // private
639
+ maxCanvasZoom: number // private
640
+ placeOtherGroup: boolean
641
+ defaultPolyLineRadius: number,
642
+ reLayoutWhenExpandedOrCollapsed: boolean
643
+ creatingSelection: boolean
644
+ selectionView: RGSelectionView
645
+ creatingNodePlot: boolean
646
+ showTemplateNode: boolean
647
+ newNodeTemplate: any
648
+ creatingLinePlot: boolean
649
+ newLineTemplate: RGLine
650
+ newLinkTemplate: any
651
+ definitelyNoDataProviderNeeded: boolean
652
+ }
653
+ /**
654
+ * Complete configuration type that includes all runtime state options, none of which can be directly configured by users
655
+ */
656
+ export type RGOptionsFull = RGOptionsInited & {
657
+ snapshotting: boolean
658
+ graphLoading: boolean
659
+ enableNodeXYAnimation: boolean
660
+ enableCanvasTransformAnimation: boolean
661
+ graphLoadingText: string
662
+ editingLineController: RGEditingLine,
663
+ editingController: RGEditingNodes,
664
+ nodeConnectController: RGConnectingNode,
665
+ showReferenceLine: boolean,
666
+ referenceLineAdsorption: boolean,
667
+ editingReferenceLine: {
668
+ show: boolean,
669
+ directionV: boolean,
670
+ directionH: boolean,
671
+ v_x: number,
672
+ v_y: number,
673
+ v_height: number,
674
+ h_x: number,
675
+ h_y: number,
676
+ h_width: number
677
+ },
678
+ showMiniView: boolean,
679
+ miniViewVisibleHandle: {
680
+ x: number,
681
+ y: number,
682
+ width: number,
683
+ height: number,
684
+ emptyContent: boolean
685
+ }
686
+ instanceId: string
687
+ viewSize: { width: number; height: number }
688
+ canvasSize: {
689
+ width: number
690
+ height: number
691
+ }
692
+ canvasOffset: {
693
+ x: number
694
+ y: number
695
+ }
696
+ fullscreen: boolean // private
697
+ showEasyView?: boolean // private
698
+ canvasOpacity?: number // private
699
+ }
700
+ /**
701
+ * Partial configuration type for relation-graph, users can configure any subset of options
702
+ */
703
+ export type RGOptions = Partial<RGOptionsInited>;
704
+ /**
705
+ * When the user performs a selection operation on the canvas (event: onCanvasSelectionEnd), the type of selection view information passed
706
+ */
707
+ export type RGSelectionView = {
708
+ x: number
709
+ y: number
710
+ width: number
711
+ height: number
712
+ };
713
+
714
+ /**
715
+ * Event handler type for relation-graph events
716
+ * @inner
717
+ */
718
+ export type RGEventHandler = (eventName: RGEventNames, ...args: any[]) => void | any;
719
+ /**
720
+ * Event emit hook type for relation-graph events
721
+ * @inner
722
+ */
723
+ export type RGEventEmitHook = (eventName: RGEventNames, ...args: any[]) => void | any;
724
+ /**
725
+ * Control point type for RGLineShape.Line44 lines
726
+ * @inner
727
+ */
728
+ export type RGCtrlPointForLine44 = {
729
+ pIndex: number,
730
+ optionName: string,
731
+ direction: 'v' | 'h',
732
+ x: number,
733
+ y: number,
734
+ startDirection: RGDirection,
735
+ endDirection: RGDirection,
736
+ hide?: boolean
737
+ }
738
+
739
+ /**
740
+ * The exposed interface type of the relation-graph component instance
741
+ * @inner
742
+ */
743
+ export interface RelationGraphExpose {
744
+ getInstance(): RelationGraphInstance;
745
+ }
746
+
747
+ /**
748
+ * Props type for RGNodeSlot component
749
+ */
750
+ export interface RGNodeSlotProps {
751
+ node: RGNode
752
+ defaultExpandHolderPosition?: string
753
+ dragging?: boolean
754
+ checked?: boolean
755
+ }
756
+
757
+ /**
758
+ * Props type for RGLineSlot component
759
+ * @inner
760
+ */
761
+ export interface RGLinePeelProps {
762
+ line: RGLine | RGFakeLine
763
+ checked?: boolean
764
+ defaultLineTextOnPath?: boolean
765
+ graphInstanceId?: string
766
+ }
767
+
768
+ /**
769
+ * Custom line slot component Props type
770
+ * @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.
771
+ * @param checked Whether the current line is selected
772
+ * @param defaultLineTextOnPath Whether the line uses textPath to typeset text, allowing the text to be arranged along the line path
773
+ * @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)
774
+ *
775
+ */
776
+ export interface RGLineSlotProps {
777
+ lineConfig: RGGenerateLineConfig
778
+ checked?: boolean
779
+ defaultLineTextOnPath?: boolean
780
+ graphInstanceId?: string
781
+ }
782
+
783
+ /**
784
+ * Props type for RGLinePath component
785
+ * @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.
786
+ * @param linePathInfo The path information of the line, including path data, text position, etc., used for rendering the line path
787
+ * @param defaultLineTextOnPath Whether the line uses textPath to typeset text, allowing the text to be arranged along the line path
788
+ * @param checked Whether the current line is selected
789
+ * @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)
790
+ *
791
+ */
792
+ export interface RGLinePathProps {
793
+ lineConfig: RGGenerateLineConfig
794
+ linePathInfo: RGLinePathInfo
795
+ useTextOnPath?: boolean
796
+ checked?: boolean
797
+ graphInstanceId?: string
798
+ }
799
+
800
+ /**
801
+ * Props type for RGLineText component
802
+ * @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.
803
+ * @param linePathInfo The path information of the line, including path data, text position, etc., used for rendering the line path
804
+ * @param checked Whether the current line is selected
805
+ *
806
+ */
807
+ export interface RGLineTextProps {
808
+ lineConfig: RGGenerateLineConfig
809
+ linePathInfo: RGLinePathInfo
810
+ checked?: boolean
811
+ }
812
+
813
+ /**
814
+ * Props type for <RelationGraph /> component
815
+ * @param options Configuration options for relation-graph
816
+ * @param relationGraphCore The core class of relation-graph, default is RelationGraphCore
817
+ */
818
+ export type RelationGraphProps = RGListeners & {
819
+ options: RGOptions;
820
+ relationGraphCore?: new (...args: any[]) => RelationGraphCore;
821
+ };
822
+
823
+ /**
824
+ * Positioning props for <RGToolBar /> components
825
+ * @param direction 'v' means vertical toolbar, 'h' means horizontal toolbar
826
+ * @param positionH 'left' means left-aligned, 'center' means center-aligned, 'right' means right-aligned
827
+ * @param positionV 'top' means top-aligned, 'center' means center-aligned, 'bottom' means bottom-aligned
828
+ */
829
+ export interface RGToolBarProps {
830
+ direction?: 'v' | 'h' | string,
831
+ positionH?: 'left' | 'center' | 'right' | string,
832
+ positionV?: 'top' | 'center' | 'bottom' | string,
833
+ }
834
+
835
+ /**
836
+ * Positioning props for <RGMiniView /> components
837
+ * @param position Position of the mini view: 'tl' | 'tr' | 'bl' | 'br' | 'top' | 'right' | 'bottom' | 'left'
838
+ * @param width Width of the mini view
839
+ * @param height Height of the mini view
840
+ */
841
+ export interface RGMiniViewProps {
842
+ position?: RGWidgetPosition,
843
+ width?: string,
844
+ height?: string,
845
+ className?: string;
846
+ style?: Record<string, string | number | undefined>,
847
+ }
848
+
849
+ /**
850
+ * Positioning props for <RGEditingNearNodeWidget /> components
851
+ * @param position Position of the widget: 'tl' | 'tr' | 'bl' | 'br' | 'top' | 'right' | 'bottom' | 'left'
852
+ */
853
+ export interface RGWidgetProps {
854
+ position?: RGWidgetPosition
855
+ }
856
+
857
+ /**
858
+ * Props type for RGEditingLineController component
859
+ * @inner
860
+ */
861
+ export interface RGEditingLineControllerProps {
862
+ textEditable?: boolean
863
+ pathEditable?: boolean
864
+ onMoveLineVertexStart?: (type: RGLineEditPoint, line: RGLine) => void
865
+ onMoveLineVertexEnd?: RGLineVertexBeDroppedEventHandler
866
+ onLinePathChanged?: (line: RGLine, params: any) => void
867
+ onLineTextDragEnd?: (line: RGLine) => void
868
+ onLineTextChanged?: (line: RGLine) => void
869
+ }
870
+
871
+ /**
872
+ * @inner
873
+ */
874
+ export type RGLineConnectEventHandler = (fromNode: RGNode | RGLineTarget | RGPosition, toNode: RGNode | RGLineTarget | RGPosition, newLineJson?: JsonLine) => void;
875
+ /**
876
+ * @inner
877
+ */
878
+ export type RGLineVertexBeDroppedEventHandler = (fromNode: RGNode | RGLineTarget | RGPosition, toNode: RGNode | RGLineTarget | RGPosition, newLineJson?: JsonLine) => void;
879
+ export type JsonNodeLike = Partial<JsonNode>;
880
+ export type JsonLineLike = Partial<JsonLine>;
881
+ export type JsonNodeTemplate = JsonNodeLike;
882
+ export type JsonLineTemplate = JsonLineLike;
883
+
884
+ /**
885
+ * @inner
886
+ */
887
+ export type CreatingLinePlotOptions = {
888
+ onCreateLine: RGLineConnectEventHandler | undefined
889
+ isReverse?: boolean,
890
+ template?: JsonLineLike
891
+ fromNode?: RGNode | RGLineTarget
892
+ };
893
+ /**
894
+ * @inner
895
+ */
896
+ export type CreatingNodePlotOptions = {
897
+ templateNode: JsonNodeLike
898
+ templateMove?: (x: number, y: number) => void
899
+ onCreateNode: (x: number, y: number, nodeTemplate?: JsonNodeLike) => void
900
+ };
901
+
902
+ /**
903
+ * Props type for <RGConnectSource> component
904
+ * The RGConnectSource component allows any element to have the functionality of a connection starting point.
905
+ * @param lineTemplate The template information for the connection line, which can be partial properties of JsonLine
906
+ * @param onConnectStart Callback function triggered when starting to initiate a connection line
907
+ * @param onConnectEnd Callback function triggered when the connection line initiation ends
908
+ * @param className Custom class name for the component
909
+ * @param style Custom styles for the component
910
+ * @example
911
+ * ```tsx
912
+ * import {RGLineShape} from 'relation-graph-react';
913
+ *
914
+ * <RGConnectSource
915
+ * :lineTemplate="{ color: 'red', lineShape: RGLineShape.StandardCurve }"
916
+ * :onConnectEnd="(fromNode, toNode, newLineJson) => {
917
+ * console.log('Connection ended:', fromNode, toNode, newLineJson);
918
+ * // You can add the new line to the graph here
919
+ * graphInstance.addLines([newLineJson]);
920
+ * }"
921
+ * >
922
+ * <div class="my-connect-source">
923
+ * Drag from here to connect
924
+ * </div>
925
+ * </RGConnectSource>
926
+ * ```
927
+ */
928
+ export interface RGConnectSourceProps {
929
+ lineTemplate: JsonLineLike;
930
+ onConnectStart?: (newLineTemplate?: JsonLineLike, event?: RGUserEvent) => void;
931
+ onConnectEnd?: RGLineConnectEventHandler; // default is true
932
+ className?: string;
933
+ style?: Record<string, string | number | undefined>,
934
+ }
935
+
936
+ /**
937
+ * Component <RGConnectTarget> Props type
938
+ * 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.
939
+ * 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.
940
+ * @param junctionPoint Specifies the junction point information of the connection target
941
+ * @param targetId The target ID corresponding to the connection target, which can be a node ID or a special identifier
942
+ * @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
943
+ * @param targetData Additional data for the connection target, which can store any information related to the target
944
+ * @param onLineVertexBeDropped Callback function triggered when a line endpoint is dragged to this connection target and released
945
+ * @param lineTemplate The template information for the connection line, which can be partial properties of JsonLine
946
+ * @param disableDrop Whether to disable the function of dragging the line endpoint to this connection target for connection, default is false
947
+ * @param disableDrag Whether to disable the function of initiating line connection from this connection target, default is false
948
+ * @param onDragConnectStart Callback function triggered when starting to drag from this connection target to initiate a connection line
949
+ * @param onDragConnectEnd Callback function triggered when the connection line initiated by dragging from this connection target is released
950
+ * @param className Custom class name for the component
951
+ * @param style Custom styles for the component
952
+ * @example
953
+ * ```tsx
954
+ * import {RGJunctionPoint, RGLineShape} from 'relation-graph-react';
955
+ *
956
+ * <RGConnectTarget
957
+ * :junctionPoint="RGJunctionPoint.Bottom"
958
+ * targetId="my-target-1"
959
+ * :targetData="{ info: 'additional data' }"
960
+ * :lineTemplate="{ color: '#ff0000', lineShape: RGLineShape.StandardStraight, data: { info: 'additional data' } }"
961
+ * >
962
+ * <div class="my-connect-target">
963
+ * Drop line here or drag from here to connect
964
+ * </div>
965
+ * </RGConnectTarget>
966
+ * ```
967
+ */
968
+ export interface RGConnectTargetProps {
969
+ junctionPoint?: RGJunctionPoint;
970
+ targetId: string;
971
+ targetType?: string;
972
+ targetData?: Record<string, any>;
973
+ onLineVertexBeDropped?: RGLineVertexBeDroppedEventHandler;
974
+ lineTemplate?: JsonLineLike;
975
+ disableDrop?: boolean;
976
+ disableDrag?: boolean;
977
+ onDragConnectStart?: (newLineTemplate?: JsonLineLike, event?: RGUserEvent) => void;
978
+ onDragConnectEnd?: RGLineConnectEventHandler; // default is true
979
+ className?: string;
980
+ forSvg?: boolean;
981
+ style?: Record<string, string | number | undefined>,
982
+ }
983
+
984
+ /**
985
+ * 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.
986
+ * @deprecated
987
+ */
988
+ export interface RGWatermarkProps {
989
+ forImage?: boolean,
990
+ forDisplay?: boolean,
991
+ position?: RGWidgetPosition,
992
+ width?: string,
993
+ height?: string
994
+ }
995
+
996
+ /**
997
+ * 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.
998
+ * @deprecated
999
+ */
1000
+ export interface RGBackgroundProps {
1001
+ forImage?: boolean,
1002
+ forDisplay?: boolean,
1003
+ }
1004
+
1005
+ /**
1006
+ * @inner
1007
+ */
1008
+ export type RGLineTextPosition = {
1009
+ x: number;
1010
+ y: number;
1011
+ rotate: number;
1012
+ };
1013
+ /**
1014
+ * Configuration parameter type passed in when generating line path and rendering information
1015
+ * @param line The line object or fake line object
1016
+ * @param from The starting object of the line
1017
+ * @param to The ending object of the line
1018
+ * @param totalLinesBetweenNodes Total number of lines between the two nodes (including this line)
1019
+ * @param currentLineIndex The index of the current line among the lines between the two nodes (starting from 0)
1020
+ * @param defaultOptions Global default configuration options for rendering lines
1021
+ */
1022
+ export type RGGenerateLineConfig = {
1023
+ line: RGLine | RGFakeLine,
1024
+ from?: RGLineTarget,
1025
+ to?: RGLineTarget,
1026
+ totalLinesBetweenNodes?: number,
1027
+ currentLineIndex?: number,
1028
+ defaultOptions?: any
1029
+ }
1030
+ /**
1031
+ * English: Callback function type for generating fake line target objects when rendering custom lines
1032
+ * @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.
1033
+ * @param targetId The id of the connectable object (e.g., node id, RGConnectTarget's targetId)
1034
+ * @param fakeLine The fake line object
1035
+ * @returns Returns the corresponding line target object
1036
+ *
1037
+ */
1038
+ export type RGFakeLineTargetRender = (targetType: string, targetId: string, fakeLine: RGFakeLine) => RGLineTarget;
1039
+ /**
1040
+ * @inner
1041
+ */
1042
+ export type RGGenerateLinePrams = {
1043
+ line: RGLine,
1044
+ totalLinesBetweenNodes: number,
1045
+ currentLineIndex: number,
1046
+ lineDirection: 'v' | 'h',
1047
+ lineShape: RGLineShape,
1048
+ lineRadius: number,
1049
+ fromJunctionPoint: RGJunctionPoint,
1050
+ toJunctionPoint: RGJunctionPoint,
1051
+ fx: number,
1052
+ fy: number,
1053
+ fcx: number,
1054
+ fcy: number,
1055
+ f_W: number,
1056
+ f_H: number,
1057
+ tx: number,
1058
+ ty: number,
1059
+ tcx: number,
1060
+ tcy: number,
1061
+ t_W: number,
1062
+ t_H: number
1063
+ }
1064
+ /**
1065
+ * Line path information generated by relation-graph
1066
+ * @param pathData SVG Path data of the line
1067
+ * @param pathCommands Command point information of the line path
1068
+ * @param textPosition Position and rotation information of the line text
1069
+ * @param points Array of key point coordinates on the line path
1070
+ * @param startDirection Line start direction (only valid for certain line shapes)
1071
+ * @param endDirection Line end direction (only valid for certain line shapes)
1072
+ */
1073
+ export type RGLinePathInfo = {
1074
+ pathData: string;
1075
+ pathCommands: RGLinePathCommands;
1076
+ textPosition: RGLineTextPosition,
1077
+ points: RGCoordinate[],
1078
+ startDirection?: RGDirection,
1079
+ endDirection?: RGDirection,
1080
+ };
1081
+ /**
1082
+ * @inner
1083
+ */
1084
+ export type CalcNode = {
1085
+ rgNode: RGNode;
1086
+ x: number;
1087
+ y: number;
1088
+ width: number;
1089
+ height: number;
1090
+ };
1091
+ /**
1092
+ * @inner
1093
+ */
1094
+ export type WriteableData<T> = {
1095
+ set(this: void, value: T): void;
1096
+ // value(): T;
1097
+ // /**
1098
+ // * Update value using callback and inform subscribers.
1099
+ // * @param updater callback
1100
+ // */
1101
+ // update(this: void, updater: (v: T) => T): void;
1102
+ }
1103
+ /**
1104
+ * @inner
1105
+ */
1106
+ export type ReactiveDataStores = {
1107
+ store4Options: WriteableData<RGOptionsFull>,
1108
+ store4ShouldRenderNodes: WriteableData<RGNode[]>,
1109
+ store4ShouldRenderLines: WriteableData<RGLine[]>,
1110
+ store4ShouldRenderFakeLines: WriteableData<RGFakeLine[]>,
1111
+ optionsRef?: any, // Store Vue reactive data
1112
+ shouldRenderNodesRef?: any, // Store Vue reactive data
1113
+ shouldRenderLinesRef?: any, // Store Vue reactive data
1114
+ shouldRenderFakeLinesRef?: any, // Store Vue reactive data
1115
+ textContainer4NormalRef?:any,
1116
+ textContainer4FakeLineRef?:any
1117
+ }
1118
+ /**
1119
+ * @inner
1120
+ */
1121
+ export type ReactiveDataUpdaters = {
1122
+ updateStore4Options: (newValue: RGOptionsFull) => void,
1123
+ updateStore4ShouldRenderNodes: (newValue: RGNode[]) => void,
1124
+ updateStore4ShouldRenderLines: (newValue: RGLine[]) => void,
1125
+ updateStore4FakeLines: (newValue: RGFakeLine[]) => void,
1126
+ }
1127
+ /**
1128
+ * Reactive data object returned by hooks provided by the relation-graph component:
1129
+ * - information about the line being created (the line being dragged into the canvas)
1130
+ * @param creating Whether a line is being created
1131
+ * @param fromTarget The starting target of the line being created
1132
+ * @param toTarget The ending target of the line being created
1133
+ * @param lineJson The JsonLine information of the line being created
1134
+ */
1135
+ export type RGCreatingLine = {
1136
+ creating: true,
1137
+ fromTarget?: RGLineTarget,
1138
+ toTarget?: RGLineTarget,
1139
+ lineJson?: JsonLine
1140
+ } | {
1141
+ creating: false
1142
+ }
1143
+
1144
+ /**
1145
+ * Reactive data object returned by hooks provided by the relation-graph component:
1146
+ * - information about the node being created (the node being dragged into the canvas)
1147
+ * @param creating Whether a node is being created
1148
+ * @param nodeJson The JsonNode information of the node being created
1149
+ */
1150
+ export type RGCreatingNode = {
1151
+ creating: true,
1152
+ nodeJson?: JsonNode
1153
+ } | {
1154
+ creating: false
1155
+ }
1156
+ /**
1157
+ * Reactive data object returned by hooks provided by the relation-graph component:
1158
+ * - information about the nodes being edited
1159
+ * @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.
1160
+ * @param nodes The array of nodes being edited
1161
+ * @param x The X position of the editing box
1162
+ * @param y The Y position of the editing box
1163
+ * @param width The width of the editing box
1164
+ * @param height The height of the editing box
1165
+ */
1166
+ export type RGEditingNodes = {
1167
+ show: boolean,
1168
+ nodes: RGNode[],
1169
+ x: number,
1170
+ y: number,
1171
+ width: number,
1172
+ height: number
1173
+ }
1174
+ /**
1175
+ * Reactive data object returned by hooks provided by the relation-graph component:
1176
+ * - Information about the node being connected when creating a line
1177
+ * @param x The X position of the connecting box
1178
+ * @param y The Y position of the connecting box
1179
+ * @param width The width of the connecting box
1180
+ * @param height The height of the connecting box
1181
+ */
1182
+ export type RGConnectingNode = {
1183
+ show: boolean,
1184
+ node: RGNode | RGLineTarget | RGRectTarget,
1185
+ x: number,
1186
+ y: number,
1187
+ width: number,
1188
+ height: number
1189
+ }
1190
+ /**
1191
+ * Reactive data object returned by hooks provided by the relation-graph component:
1192
+ * - Information about the line being edited
1193
+ * @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.
1194
+ * @param line The line being edited
1195
+ * @param startPoint The starting point of the line being edited
1196
+ * @param endPoint The ending point of the line being edited
1197
+ */
1198
+ export type RGEditingLine = {
1199
+ show: boolean,
1200
+ line: RGLine | null,
1201
+ startPoint: RGPosition,
1202
+ endPoint: RGPosition,
1203
+ text: {
1204
+ show: boolean,
1205
+ x: number,
1206
+ y: number,
1207
+ width: number,
1208
+ height: number
1209
+ },
1210
+ ctrlPoints: RGPosition[],
1211
+ selectedLines: string[],
1212
+ line44Splits: RGCtrlPointForLine44[],
1213
+ line49Points: RGPosition[],
1214
+ ctrlPoint1: RGPosition,
1215
+ ctrlPoint2: RGPosition,
1216
+ toolbar: RGPosition
1217
+ }
1218
+ /**
1219
+ * Reactive data object returned by hooks provided by the relation-graph component:
1220
+ * - Current view information
1221
+ * @param viewSize The size of the view area
1222
+ * @param fullscreen Whether it is in fullscreen mode
1223
+ * @param canvasSize The size of the canvas
1224
+ * @param canvasZoom The zoom level of the canvas
1225
+ * @param canvasOffset The offset position of the canvas
1226
+ */
1227
+ export type RGViewInformation = {
1228
+ viewSize: { width: number; height: number },
1229
+ fullscreen: boolean,
1230
+ canvasSize: { width: number; height: number },
1231
+ canvasZoom: number,
1232
+ canvasOffset: { x: number; y: number },
1233
+ showEasyView?: boolean,
1234
+ }
1235
+ /**
1236
+ * Reactive data object returned by hooks provided by the relation-graph component:
1237
+ * - Information about the currently selected node or lines
1238
+ * @param checkedLineId The ID of the selected line
1239
+ * @param checkedNodeId The ID of the selected node
1240
+ * @param draggingNodeId The ID of the node being dragged
1241
+ */
1242
+ export type RGCheckedItem = {
1243
+ checkedLineId?: string;
1244
+ checkedNodeId?: string;
1245
+ draggingNodeId?: string;
1246
+ }
1247
+
1248
+ /**
1249
+ * Enumeration of all event names supported by relation-graph
1250
+ */
1251
+ export enum RGEventNames {
1252
+ onReady = 'onReady',
1253
+ onNodeClick = 'onNodeClick',
1254
+ onNodeExpand = 'onNodeExpand',
1255
+ onNodeCollapse = 'onNodeCollapse',
1256
+ onLineClick = 'onLineClick',
1257
+ onNodeDragStart = 'onNodeDragStart',
1258
+ onNodeDragEnd = 'onNodeDragEnd',
1259
+ onNodeDragging = 'onNodeDragging',
1260
+ onCanvasDragEnd = 'onCanvasDragEnd',
1261
+ onCanvasDragging = 'onCanvasDragging',
1262
+ onContextmenu = 'onContextmenu',
1263
+ onFullscreen = 'onFullscreen',
1264
+ onCanvasClick = 'onCanvasClick',
1265
+ onCanvasSelectionEnd = 'onCanvasSelectionEnd',
1266
+ beforeZoomStart = 'beforeZoomStart',
1267
+ onZoomEnd = 'onZoomEnd',
1268
+ onViewResize = 'onViewResize',
1269
+ onResizeStart = 'onResizeStart',
1270
+ beforeNodeResize = 'beforeNodeResize',
1271
+ onResizeEnd = 'onResizeEnd',
1272
+ onLineVertexDropped = 'onLineVertexDropped',
1273
+ beforeCreateLine = 'beforeCreateLine',
1274
+ onLineBeCreated = 'onLineBeCreated',
1275
+ beforeAddNodes = 'beforeAddNodes',
1276
+ beforeAddLines = 'beforeAddLines',
1277
+ onKeyboardDown = 'onKeyboardDown',
1278
+ onKeyboardUp = 'onKeyboardUp',
1279
+ onCanvasDragStart = 'onCanvasDragStart',
1280
+ onForceLayoutFinish = 'onForceLayoutFinish',
1281
+ beforeScrollStart = 'beforeScrollStart'
1282
+ }
1283
+ /**
1284
+ * All event listener types supported by the relation-graph component
1285
+ */
1286
+ export interface RGListeners {
1287
+ /**
1288
+ * When the graph is ready, this event is triggered
1289
+ * @param graphInstance The relation-graph instance object
1290
+ */
1291
+ onReady?: (graphInstance: RelationGraphInstance) => void;
1292
+ /**
1293
+ * Triggered when a node is clicked
1294
+ */
1295
+ onNodeClick?: (node: RGNode, e: RGUserEvent) => boolean | void | Promise<boolean | void>;
1296
+ /**
1297
+ * Triggered when a node is expanded
1298
+ */
1299
+ onNodeExpand?: (node: RGNode, e: RGUserEvent) => boolean | void | Promise<boolean | void>;
1300
+ /**
1301
+ * Triggered when a node is collapsed
1302
+ */
1303
+ onNodeCollapse?: (node: RGNode, e: RGUserEvent) => boolean | void | Promise<boolean | void>;
1304
+ /**
1305
+ * Triggered when a line is clicked, line is the line, link is the RGLink object corresponding to the line
1306
+ */
1307
+ onLineClick?: (line: RGLine, link: RGLink, e: RGUserEvent) => boolean | void | Promise<boolean | void>;
1308
+ /**
1309
+ * Triggered when a node drag starts
1310
+ * @param node The dragged node
1311
+ */
1312
+ onNodeDragStart?: (node: RGNode, e: RGUserEvent) => void;
1313
+ /**
1314
+ * Triggered when a node drag ends
1315
+ * @param node The dragged node
1316
+ * @param e The event that triggered the drag end
1317
+ * @param x_buff The x offset at the end of the drag
1318
+ * @param y_buff The y offset at the end of the drag
1319
+ *
1320
+ */
1321
+ onNodeDragEnd?: (node: RGNode, e: RGUserEvent, x_buff: number, y_buff: number) => void;
1322
+ /**
1323
+ * Triggered when a node is being dragged
1324
+ * @param node The dragged node
1325
+ * @param newX The new X position of the node
1326
+ * @param newY The new Y position of the node
1327
+ * @param buffX The X offset of the node from the start of the drag to the current position
1328
+ * @param buffY The Y offset of the node from the start of the drag to the current position
1329
+ * @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
1330
+ */
1331
+ onNodeDragging?: (node: RGNode, newX: number, newY: number, buffX: number, buffY: number, e: RGUserEvent) => void | RGPosition | undefined;
1332
+ /**
1333
+ * Triggered when the canvas drag ends
1334
+ */
1335
+ onCanvasDragEnd?: (e: RGUserEvent) => void;
1336
+ /**
1337
+ * Triggered when the canvas is being dragged
1338
+ * @param newX The new offset X of the canvas
1339
+ * @param newY The new offset Y of the canvas
1340
+ * @param buffX The X offset of the canvas from the start of the drag to the current position
1341
+ * @param buffY The Y offset of the canvas from the start of the drag to the current position
1342
+ * @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
1343
+ */
1344
+ onCanvasDragging?: (newX: number, newY: number, buffX: number, buffY: number) => void | RGPosition | undefined;
1345
+ /**
1346
+ * Triggered when the canvas is right-clicked
1347
+ * @param e The event that triggered
1348
+ * @param objectType The type of object, which can be 'canvas', 'node', or 'line'
1349
+ * @param object The clicked object, which can be undefined, RGNode, or RGLine
1350
+ * @param eventPositionOnCanvas The coordinates of the event on the canvas
1351
+ * @param eventPositionOnView The coordinates of the event on the view (relative to the top-left corner of the <RelationGraph> component)
1352
+ */
1353
+ onContextmenu?: (e: RGUserEvent, objectType: RGEventTargetType, object: RGNode | RGLine | undefined, eventPositionOnCanvas: RGCoordinate, eventPositionOnView: RGCoordinate) => void;
1354
+ /**
1355
+ * Triggered when the fullscreen state changes
1356
+ * @param newValue The new fullscreen state
1357
+ * @param defaultFullscreen The function to perform the default fullscreen toggle operation
1358
+ */
1359
+ onFullscreen?: (newValue: boolean, defaultFullscreen: () => Promise<void>) => void;
1360
+ /**
1361
+ * Triggered when the canvas is clicked
1362
+ * - This event will not be triggered when clicking on nodes or lines
1363
+ */
1364
+ onCanvasClick?: (e: RGUserEvent) => void;
1365
+ /**
1366
+ * Triggered when the canvas selection ends
1367
+ * @param selectionView The area information of the canvas selection, including x, y, width, height
1368
+ */
1369
+ onCanvasSelectionEnd?: (selectionView: RGSelectionView, e: RGUserEvent) => void;
1370
+ /**
1371
+ * Triggered before zooming starts
1372
+ * @return Returning false can prevent the zoom operation
1373
+ */
1374
+ beforeZoomStart?: () => void | false;
1375
+ /**
1376
+ * Triggered when zooming ends
1377
+ */
1378
+ onZoomEnd?: () => void;
1379
+ /**
1380
+ * Triggered when the view size changes
1381
+ */
1382
+ onViewResize?: () => void;
1383
+ /**
1384
+ * Triggered when one or more nodes (via RGEditingResize) start being resized
1385
+ * @param nodes The array of nodes being resized
1386
+ */
1387
+ onResizeStart?: (nodes: RGNode[], e: RGUserEvent) => void;
1388
+ /**
1389
+ * Triggered before resizing a node, returning false can prevent the resize operation
1390
+ * @param node The node being resized
1391
+ * @param newX The new X position to be resized to
1392
+ * @param newY The new Y position to be resized to
1393
+ * @param newW The new width to be resized to
1394
+ * @param newH The new height to be resized to
1395
+ * @return Return false to prevent resizing
1396
+ */
1397
+ beforeNodeResize?: (node: RGNode, newX: number, newY: number, newW: number, newH: number) => void | false;
1398
+ /**
1399
+ * Triggered when one or more nodes (via RGEditingResize) finish being resized
1400
+ * @param nodes The array of nodes that were resized
1401
+ * @param buffX The X offset at the end of the resize
1402
+ * @param buffY The Y offset at the end of the resize
1403
+ */
1404
+ onResizeEnd?: (nodes: RGNode[], buffX: number, buffY: number, e: RGUserEvent) => void;
1405
+ /**
1406
+ * Triggered when the endpoint (start or end) of a line is dropped
1407
+ * @param fromNode The starting node
1408
+ * @param toNode The target node
1409
+ * @param lineTemplate The line information (JsonLine)
1410
+ *
1411
+ */
1412
+ onLineVertexDropped?: (lineInfo: {
1413
+ newLineTemplate: JsonLine,
1414
+ fromNode: RGLineTarget | RGNode,
1415
+ toNode: RGLineTarget | RGNode
1416
+ }) => void;
1417
+ /**
1418
+ * 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.
1419
+ * @param fromNode The starting node
1420
+ * @param toNode The target node
1421
+ * @param lineTemplate The line information (JsonLine)
1422
+ *
1423
+ */
1424
+ beforeCreateLine?: (lineInfo: {
1425
+ lineJson: JsonLine,
1426
+ fromNode: RGLineTarget | RGNode,
1427
+ toNode: RGLineTarget | RGNode
1428
+ }) => void | false;
1429
+ /**
1430
+ * Triggered when a new line is created or the endpoint is modified
1431
+ * - 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.
1432
+ * - 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.
1433
+ * @param fromNode The starting node
1434
+ * @param toNode The target node
1435
+ * @param lineTemplate The line information (JsonLine)
1436
+ */
1437
+ onLineBeCreated?: (lineInfo: {
1438
+ lineJson: JsonLine,
1439
+ fromNode: RGLineTarget | RGNode,
1440
+ toNode: RGLineTarget | RGNode
1441
+ }) => void;
1442
+ /**
1443
+ * Triggered before new nodes are added (via setJsonData, addNodes methods) to the graph
1444
+ * @param nodes The array of jsonNode objects that are about to be added
1445
+ */
1446
+ beforeAddNodes?: (nodes: JsonNode[]) => void;
1447
+ /**
1448
+ * Triggered before new lines are added (via setJsonData, addLines methods) to the graph
1449
+ * @param lines The array of jsonLine objects that are about to be added
1450
+ */
1451
+ beforeAddLines?: (lines: JsonLine[]) => void;
1452
+ /**
1453
+ * Triggered when the keyboard is pressed down in the graph area
1454
+ * @param e
1455
+ */
1456
+ onKeyboardDown?: (e: KeyboardEvent) => void;
1457
+ /**
1458
+ * Triggered when the keyboard is released in the graph area
1459
+ * @param e
1460
+ */
1461
+ onKeyboardUp?: (e: KeyboardEvent) => void;
1462
+ /**
1463
+ * Triggered when canvas drag starts
1464
+ * @param canvasMoveStartPosition The initial position of the canvas when dragging starts
1465
+ * @param eventClientStartPosition The client position of the user event when it starts
1466
+ * @param e
1467
+ */
1468
+ onCanvasDragStart?: (canvasMoveStartPosition: RGPosition, eventClientStartPosition: RGPosition, e: RGUserEvent) => void;
1469
+ /**
1470
+ * Triggered when the force-directed layout calculation is completed
1471
+ */
1472
+ onForceLayoutFinish?: () => void;
1473
+ /**
1474
+ * Triggered before performing canvas move scroll, returning true indicates to prevent the scroll from continuing
1475
+ * @param buffX The X offset that is about to be scrolled
1476
+ * @param buffY The Y offset that is about to be scrolled
1477
+ * @return true = Abort Scroll
1478
+ */
1479
+ beforeScrollStart?: (buffX: number, buffY: number, e: Event) => true | undefined | void;
1480
+ }