@gravity-ui/querieskit 1.5.1 → 1.6.0

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 (338) hide show
  1. package/README.md +28 -0
  2. package/build/cjs/components/QueryGraph/QueryGraph.css +70 -0
  3. package/build/cjs/components/QueryGraph/QueryGraph.css.map +1 -0
  4. package/build/cjs/components/QueryGraph/QueryGraph.d.ts +4 -0
  5. package/build/cjs/components/QueryGraph/QueryGraph.js +517 -0
  6. package/build/cjs/components/QueryGraph/QueryGraph.js.map +1 -0
  7. package/build/cjs/components/QueryGraph/QueryGraph.stories.d.ts +16 -0
  8. package/build/cjs/components/QueryGraph/QueryGraph.stories.js +339 -0
  9. package/build/cjs/components/QueryGraph/QueryGraph.stories.js.map +1 -0
  10. package/build/cjs/components/QueryGraph/helpers/layout.d.ts +9 -0
  11. package/build/cjs/components/QueryGraph/helpers/layout.js +138 -0
  12. package/build/cjs/components/QueryGraph/helpers/layout.js.map +1 -0
  13. package/build/cjs/components/QueryGraph/helpers/presentation.d.ts +18 -0
  14. package/build/cjs/components/QueryGraph/helpers/presentation.js +44 -0
  15. package/build/cjs/components/QueryGraph/helpers/presentation.js.map +1 -0
  16. package/build/cjs/components/QueryGraph/i18n/dicts.d.ts +55 -0
  17. package/build/cjs/components/QueryGraph/i18n/dicts.js +14 -0
  18. package/build/cjs/components/QueryGraph/i18n/dicts.js.map +1 -0
  19. package/build/cjs/components/QueryGraph/i18n/en.json +26 -0
  20. package/build/cjs/components/QueryGraph/i18n/index.d.ts +6 -0
  21. package/build/cjs/components/QueryGraph/i18n/index.js +11 -0
  22. package/build/cjs/components/QueryGraph/i18n/index.js.map +1 -0
  23. package/build/cjs/components/QueryGraph/i18n/ru.json +26 -0
  24. package/build/cjs/components/QueryGraph/index.d.ts +2 -0
  25. package/build/cjs/components/QueryGraph/index.js +13 -0
  26. package/build/cjs/components/QueryGraph/index.js.map +1 -0
  27. package/build/cjs/components/QueryGraph/internal/QueryGraphCanvasBlock.d.ts +24 -0
  28. package/build/cjs/components/QueryGraph/internal/QueryGraphCanvasBlock.js +307 -0
  29. package/build/cjs/components/QueryGraph/internal/QueryGraphCanvasBlock.js.map +1 -0
  30. package/build/cjs/components/QueryGraph/internal/QueryGraphPopup.d.ts +5 -0
  31. package/build/cjs/components/QueryGraph/internal/QueryGraphPopup.js +242 -0
  32. package/build/cjs/components/QueryGraph/internal/QueryGraphPopup.js.map +1 -0
  33. package/build/cjs/components/QueryGraph/internal/queryGraphIcons.d.ts +12 -0
  34. package/build/cjs/components/QueryGraph/internal/queryGraphIcons.js +161 -0
  35. package/build/cjs/components/QueryGraph/internal/queryGraphIcons.js.map +1 -0
  36. package/build/cjs/components/QueryGraph/internal/useQueryGraphLayout.d.ts +22 -0
  37. package/build/cjs/components/QueryGraph/internal/useQueryGraphLayout.js +60 -0
  38. package/build/cjs/components/QueryGraph/internal/useQueryGraphLayout.js.map +1 -0
  39. package/build/cjs/components/QueryGraph/story/largeGraphData.d.ts +3 -0
  40. package/build/cjs/components/QueryGraph/story/largeGraphData.js +227 -0
  41. package/build/cjs/components/QueryGraph/story/largeGraphData.js.map +1 -0
  42. package/build/cjs/components/index.d.ts +2 -0
  43. package/build/cjs/components/index.js +9 -1
  44. package/build/cjs/components/index.js.map +1 -1
  45. package/build/cjs/helpers/buildColumnsFromKeys.d.ts +1 -1
  46. package/build/cjs/helpers/buildColumnsFromKeys.js.map +1 -1
  47. package/build/cjs/index.d.ts +1 -0
  48. package/build/cjs/index.js +11 -0
  49. package/build/cjs/index.js.map +1 -1
  50. package/build/cjs/modules/ClustersList/ClustersList.d.ts +1 -1
  51. package/build/cjs/modules/ClustersList/ClustersList.js +4 -3
  52. package/build/cjs/modules/ClustersList/ClustersList.js.map +1 -1
  53. package/build/cjs/modules/HistoryHeader/HistoryHeader.js +4 -3
  54. package/build/cjs/modules/HistoryHeader/HistoryHeader.js.map +1 -1
  55. package/build/cjs/modules/HistoryRow/HistoryRow.js +12 -7
  56. package/build/cjs/modules/HistoryRow/HistoryRow.js.map +1 -1
  57. package/build/cjs/modules/HistorySearchRow/HistorySearchRow.js +8 -5
  58. package/build/cjs/modules/HistorySearchRow/HistorySearchRow.js.map +1 -1
  59. package/build/cjs/modules/HistorySearchRow/helpers/resolveMonacoLanguage.d.ts +1 -1
  60. package/build/cjs/modules/HistorySearchRow/helpers/resolveMonacoLanguage.js +5 -5
  61. package/build/cjs/modules/HistorySearchRow/helpers/resolveMonacoLanguage.js.map +1 -1
  62. package/build/cjs/modules/NavigationDetail/NavigationDetail.d.ts +1 -1
  63. package/build/cjs/modules/NavigationDetail/NavigationDetail.js +2 -2
  64. package/build/cjs/modules/NavigationDetail/NavigationDetail.js.map +1 -1
  65. package/build/cjs/modules/NavigationHeader/NavigationHeader.d.ts +1 -1
  66. package/build/cjs/modules/NavigationHeader/NavigationHeader.js +2 -2
  67. package/build/cjs/modules/NavigationHeader/NavigationHeader.js.map +1 -1
  68. package/build/cjs/modules/NavigationItemsList/NavigationItemsList.d.ts +1 -1
  69. package/build/cjs/modules/NavigationItemsList/NavigationItemsList.js +4 -3
  70. package/build/cjs/modules/NavigationItemsList/NavigationItemsList.js.map +1 -1
  71. package/build/cjs/modules/NavigationItemsList/internal/NavigationItemsListEmptyState.d.ts +1 -1
  72. package/build/cjs/modules/NavigationItemsList/internal/NavigationItemsListEmptyState.js +2 -2
  73. package/build/cjs/modules/NavigationItemsList/internal/NavigationItemsListEmptyState.js.map +1 -1
  74. package/build/cjs/modules/NavigationMeta/NavigationMeta.js +4 -3
  75. package/build/cjs/modules/NavigationMeta/NavigationMeta.js.map +1 -1
  76. package/build/cjs/modules/NavigationMeta/i18n/index.d.ts +2 -2
  77. package/build/cjs/modules/NavigationPreview/NavigationPreview.d.ts +1 -1
  78. package/build/cjs/modules/NavigationPreview/NavigationPreview.js +6 -4
  79. package/build/cjs/modules/NavigationPreview/NavigationPreview.js.map +1 -1
  80. package/build/cjs/modules/NavigationPreview/helpers/buildPreviewColumns.d.ts +1 -1
  81. package/build/cjs/modules/NavigationPreview/helpers/buildPreviewColumns.js.map +1 -1
  82. package/build/cjs/modules/NavigationSchema/NavigationSchema.d.ts +1 -1
  83. package/build/cjs/modules/NavigationSchema/NavigationSchema.js +4 -3
  84. package/build/cjs/modules/NavigationSchema/NavigationSchema.js.map +1 -1
  85. package/build/cjs/modules/NavigationSchema/helpers/buildSchemaColumns.d.ts +1 -1
  86. package/build/cjs/modules/NavigationSchema/helpers/buildSchemaColumns.js.map +1 -1
  87. package/build/cjs/modules/NavigationView/NavigationView.d.ts +1 -1
  88. package/build/cjs/modules/NavigationView/NavigationView.js +4 -3
  89. package/build/cjs/modules/NavigationView/NavigationView.js.map +1 -1
  90. package/build/cjs/modules/NavigationView/helpers/buildViewColumns.d.ts +1 -1
  91. package/build/cjs/modules/NavigationView/helpers/buildViewColumns.js.map +1 -1
  92. package/build/cjs/modules/NavigationView/internal/NavigationViewSectionItem.d.ts +1 -1
  93. package/build/cjs/modules/NavigationView/internal/NavigationViewSectionItem.js +4 -3
  94. package/build/cjs/modules/NavigationView/internal/NavigationViewSectionItem.js.map +1 -1
  95. package/build/cjs/modules/QueriesList/QueriesList.js +2 -2
  96. package/build/cjs/modules/QueriesList/QueriesList.js.map +1 -1
  97. package/build/cjs/modules/QueryProgress/QueryProgress.css +64 -0
  98. package/build/cjs/modules/QueryProgress/QueryProgress.css.map +1 -0
  99. package/build/cjs/modules/QueryProgress/QueryProgress.d.ts +4 -0
  100. package/build/cjs/modules/QueryProgress/QueryProgress.js +135 -0
  101. package/build/cjs/modules/QueryProgress/QueryProgress.js.map +1 -0
  102. package/build/cjs/modules/QueryProgress/QueryProgress.stories.d.ts +7 -0
  103. package/build/cjs/modules/QueryProgress/QueryProgress.stories.js +38 -0
  104. package/build/cjs/modules/QueryProgress/QueryProgress.stories.js.map +1 -0
  105. package/build/cjs/modules/QueryProgress/i18n/dicts.d.ts +25 -0
  106. package/build/cjs/modules/QueryProgress/i18n/dicts.js +14 -0
  107. package/build/cjs/modules/QueryProgress/i18n/dicts.js.map +1 -0
  108. package/build/cjs/modules/QueryProgress/i18n/en.json +11 -0
  109. package/build/cjs/modules/QueryProgress/i18n/index.d.ts +6 -0
  110. package/build/cjs/modules/QueryProgress/i18n/index.js +11 -0
  111. package/build/cjs/modules/QueryProgress/i18n/index.js.map +1 -0
  112. package/build/cjs/modules/QueryProgress/i18n/ru.json +11 -0
  113. package/build/cjs/modules/QueryProgress/index.d.ts +2 -0
  114. package/build/cjs/modules/QueryProgress/index.js +13 -0
  115. package/build/cjs/modules/QueryProgress/index.js.map +1 -0
  116. package/build/cjs/modules/QueryStatistics/i18n/index.d.ts +2 -2
  117. package/build/cjs/modules/RowsList/RowsList.js +4 -3
  118. package/build/cjs/modules/RowsList/RowsList.js.map +1 -1
  119. package/build/cjs/modules/SavedQueryRow/SavedQueryRow.d.ts +2 -2
  120. package/build/cjs/modules/SavedQueryRow/SavedQueryRow.js +6 -4
  121. package/build/cjs/modules/SavedQueryRow/SavedQueryRow.js.map +1 -1
  122. package/build/cjs/modules/SavedQuerySearchRow/SavedQuerySearchRow.d.ts +2 -2
  123. package/build/cjs/modules/SavedQuerySearchRow/SavedQuerySearchRow.js +4 -3
  124. package/build/cjs/modules/SavedQuerySearchRow/SavedQuerySearchRow.js.map +1 -1
  125. package/build/cjs/modules/TutorialRow/TutorialRow.d.ts +1 -1
  126. package/build/cjs/modules/TutorialRow/TutorialRow.js +2 -2
  127. package/build/cjs/modules/TutorialRow/TutorialRow.js.map +1 -1
  128. package/build/cjs/modules/TutorialSearchRow/TutorialSearchRow.d.ts +1 -1
  129. package/build/cjs/modules/TutorialSearchRow/TutorialSearchRow.js +4 -3
  130. package/build/cjs/modules/TutorialSearchRow/TutorialSearchRow.js.map +1 -1
  131. package/build/cjs/modules/index.d.ts +2 -0
  132. package/build/cjs/modules/index.js +8 -0
  133. package/build/cjs/modules/index.js.map +1 -1
  134. package/build/cjs/types/queryGraph.d.ts +87 -0
  135. package/build/cjs/types/queryGraph.js +6 -0
  136. package/build/cjs/types/queryGraph.js.map +1 -0
  137. package/build/cjs/widgets/DashboardCharts/DashboardCharts.js +8 -6
  138. package/build/cjs/widgets/DashboardCharts/DashboardCharts.js.map +1 -1
  139. package/build/cjs/widgets/DashboardCharts/types.d.ts +3 -3
  140. package/build/cjs/widgets/DashboardCharts/types.js.map +1 -1
  141. package/build/cjs/widgets/QueriesHistory/QueriesHistory.js +2 -2
  142. package/build/cjs/widgets/QueriesHistory/QueriesHistory.js.map +1 -1
  143. package/build/cjs/widgets/QueriesHistory/internal/HistoryRowContent.js +6 -5
  144. package/build/cjs/widgets/QueriesHistory/internal/HistoryRowContent.js.map +1 -1
  145. package/build/cjs/widgets/QueriesNavigation/QueriesNavigation.d.ts +1 -1
  146. package/build/cjs/widgets/QueriesNavigation/QueriesNavigation.js +13 -9
  147. package/build/cjs/widgets/QueriesNavigation/QueriesNavigation.js.map +1 -1
  148. package/build/cjs/widgets/QueriesNavigation/helpers/createEmptyDetailConfig.js +2 -2
  149. package/build/cjs/widgets/QueriesNavigation/helpers/createEmptyDetailConfig.js.map +1 -1
  150. package/build/cjs/widgets/QueriesNavigation/helpers/createTableDetailConfig.js +8 -5
  151. package/build/cjs/widgets/QueriesNavigation/helpers/createTableDetailConfig.js.map +1 -1
  152. package/build/cjs/widgets/QueryResults/QueryResults.js +2 -2
  153. package/build/cjs/widgets/QueryResults/QueryResults.js.map +1 -1
  154. package/build/cjs/widgets/QueryResults/i18n/index.d.ts +2 -2
  155. package/build/cjs/widgets/QueryResults/internal/QueryResultsSchema.js +4 -3
  156. package/build/cjs/widgets/QueryResults/internal/QueryResultsSchema.js.map +1 -1
  157. package/build/cjs/widgets/SavedQueries/SavedQueries.d.ts +2 -2
  158. package/build/cjs/widgets/SavedQueries/SavedQueries.js +2 -2
  159. package/build/cjs/widgets/SavedQueries/SavedQueries.js.map +1 -1
  160. package/build/cjs/widgets/SavedQueries/SavedQueryRowContent.d.ts +2 -2
  161. package/build/cjs/widgets/SavedQueries/SavedQueryRowContent.js +6 -5
  162. package/build/cjs/widgets/SavedQueries/SavedQueryRowContent.js.map +1 -1
  163. package/build/cjs/widgets/TutorialsHistory/TutorialRowContent.d.ts +2 -2
  164. package/build/cjs/widgets/TutorialsHistory/TutorialRowContent.js +6 -5
  165. package/build/cjs/widgets/TutorialsHistory/TutorialRowContent.js.map +1 -1
  166. package/build/cjs/widgets/TutorialsHistory/TutorialsHistory.d.ts +2 -2
  167. package/build/cjs/widgets/TutorialsHistory/TutorialsHistory.js +6 -4
  168. package/build/cjs/widgets/TutorialsHistory/TutorialsHistory.js.map +1 -1
  169. package/build/esm/components/QueryGraph/QueryGraph.css +70 -0
  170. package/build/esm/components/QueryGraph/QueryGraph.css.map +1 -0
  171. package/build/esm/components/QueryGraph/QueryGraph.d.ts +4 -0
  172. package/build/esm/components/QueryGraph/QueryGraph.js +510 -0
  173. package/build/esm/components/QueryGraph/QueryGraph.js.map +1 -0
  174. package/build/esm/components/QueryGraph/QueryGraph.scss +81 -0
  175. package/build/esm/components/QueryGraph/QueryGraph.stories.d.ts +16 -0
  176. package/build/esm/components/QueryGraph/QueryGraph.stories.js +331 -0
  177. package/build/esm/components/QueryGraph/QueryGraph.stories.js.map +1 -0
  178. package/build/esm/components/QueryGraph/helpers/layout.d.ts +9 -0
  179. package/build/esm/components/QueryGraph/helpers/layout.js +128 -0
  180. package/build/esm/components/QueryGraph/helpers/layout.js.map +1 -0
  181. package/build/esm/components/QueryGraph/helpers/presentation.d.ts +18 -0
  182. package/build/esm/components/QueryGraph/helpers/presentation.js +35 -0
  183. package/build/esm/components/QueryGraph/helpers/presentation.js.map +1 -0
  184. package/build/esm/components/QueryGraph/i18n/dicts.d.ts +55 -0
  185. package/build/esm/components/QueryGraph/i18n/dicts.js +7 -0
  186. package/build/esm/components/QueryGraph/i18n/dicts.js.map +1 -0
  187. package/build/esm/components/QueryGraph/i18n/en.json +26 -0
  188. package/build/esm/components/QueryGraph/i18n/index.d.ts +6 -0
  189. package/build/esm/components/QueryGraph/i18n/index.js +4 -0
  190. package/build/esm/components/QueryGraph/i18n/index.js.map +1 -0
  191. package/build/esm/components/QueryGraph/i18n/ru.json +26 -0
  192. package/build/esm/components/QueryGraph/index.d.ts +2 -0
  193. package/build/esm/components/QueryGraph/index.js +2 -0
  194. package/build/esm/components/QueryGraph/index.js.map +1 -0
  195. package/build/esm/components/QueryGraph/internal/QueryGraphCanvasBlock.d.ts +24 -0
  196. package/build/esm/components/QueryGraph/internal/QueryGraphCanvasBlock.js +299 -0
  197. package/build/esm/components/QueryGraph/internal/QueryGraphCanvasBlock.js.map +1 -0
  198. package/build/esm/components/QueryGraph/internal/QueryGraphPopup.d.ts +5 -0
  199. package/build/esm/components/QueryGraph/internal/QueryGraphPopup.js +234 -0
  200. package/build/esm/components/QueryGraph/internal/QueryGraphPopup.js.map +1 -0
  201. package/build/esm/components/QueryGraph/internal/queryGraphIcons.d.ts +12 -0
  202. package/build/esm/components/QueryGraph/internal/queryGraphIcons.js +150 -0
  203. package/build/esm/components/QueryGraph/internal/queryGraphIcons.js.map +1 -0
  204. package/build/esm/components/QueryGraph/internal/useQueryGraphLayout.d.ts +22 -0
  205. package/build/esm/components/QueryGraph/internal/useQueryGraphLayout.js +53 -0
  206. package/build/esm/components/QueryGraph/internal/useQueryGraphLayout.js.map +1 -0
  207. package/build/esm/components/QueryGraph/story/largeGraphData.d.ts +3 -0
  208. package/build/esm/components/QueryGraph/story/largeGraphData.js +220 -0
  209. package/build/esm/components/QueryGraph/story/largeGraphData.js.map +1 -0
  210. package/build/esm/components/index.d.ts +2 -0
  211. package/build/esm/components/index.js +1 -0
  212. package/build/esm/components/index.js.map +1 -1
  213. package/build/esm/helpers/buildColumnsFromKeys.d.ts +1 -1
  214. package/build/esm/helpers/buildColumnsFromKeys.js.map +1 -1
  215. package/build/esm/index.d.ts +1 -0
  216. package/build/esm/index.js +1 -0
  217. package/build/esm/index.js.map +1 -1
  218. package/build/esm/modules/ClustersList/ClustersList.d.ts +1 -1
  219. package/build/esm/modules/ClustersList/ClustersList.js +2 -1
  220. package/build/esm/modules/ClustersList/ClustersList.js.map +1 -1
  221. package/build/esm/modules/HistoryHeader/HistoryHeader.js +2 -1
  222. package/build/esm/modules/HistoryHeader/HistoryHeader.js.map +1 -1
  223. package/build/esm/modules/HistoryRow/HistoryRow.js +6 -1
  224. package/build/esm/modules/HistoryRow/HistoryRow.js.map +1 -1
  225. package/build/esm/modules/HistorySearchRow/HistorySearchRow.js +4 -1
  226. package/build/esm/modules/HistorySearchRow/HistorySearchRow.js.map +1 -1
  227. package/build/esm/modules/HistorySearchRow/helpers/resolveMonacoLanguage.d.ts +1 -1
  228. package/build/esm/modules/HistorySearchRow/helpers/resolveMonacoLanguage.js +1 -1
  229. package/build/esm/modules/HistorySearchRow/helpers/resolveMonacoLanguage.js.map +1 -1
  230. package/build/esm/modules/NavigationDetail/NavigationDetail.d.ts +1 -1
  231. package/build/esm/modules/NavigationDetail/NavigationDetail.js +1 -1
  232. package/build/esm/modules/NavigationDetail/NavigationDetail.js.map +1 -1
  233. package/build/esm/modules/NavigationHeader/NavigationHeader.d.ts +1 -1
  234. package/build/esm/modules/NavigationHeader/NavigationHeader.js +1 -1
  235. package/build/esm/modules/NavigationHeader/NavigationHeader.js.map +1 -1
  236. package/build/esm/modules/NavigationItemsList/NavigationItemsList.d.ts +1 -1
  237. package/build/esm/modules/NavigationItemsList/NavigationItemsList.js +2 -1
  238. package/build/esm/modules/NavigationItemsList/NavigationItemsList.js.map +1 -1
  239. package/build/esm/modules/NavigationItemsList/internal/NavigationItemsListEmptyState.d.ts +1 -1
  240. package/build/esm/modules/NavigationItemsList/internal/NavigationItemsListEmptyState.js +1 -1
  241. package/build/esm/modules/NavigationItemsList/internal/NavigationItemsListEmptyState.js.map +1 -1
  242. package/build/esm/modules/NavigationMeta/NavigationMeta.js +2 -1
  243. package/build/esm/modules/NavigationMeta/NavigationMeta.js.map +1 -1
  244. package/build/esm/modules/NavigationMeta/i18n/index.d.ts +2 -2
  245. package/build/esm/modules/NavigationPreview/NavigationPreview.d.ts +1 -1
  246. package/build/esm/modules/NavigationPreview/NavigationPreview.js +3 -1
  247. package/build/esm/modules/NavigationPreview/NavigationPreview.js.map +1 -1
  248. package/build/esm/modules/NavigationPreview/helpers/buildPreviewColumns.d.ts +1 -1
  249. package/build/esm/modules/NavigationPreview/helpers/buildPreviewColumns.js.map +1 -1
  250. package/build/esm/modules/NavigationSchema/NavigationSchema.d.ts +1 -1
  251. package/build/esm/modules/NavigationSchema/NavigationSchema.js +2 -1
  252. package/build/esm/modules/NavigationSchema/NavigationSchema.js.map +1 -1
  253. package/build/esm/modules/NavigationSchema/helpers/buildSchemaColumns.d.ts +1 -1
  254. package/build/esm/modules/NavigationSchema/helpers/buildSchemaColumns.js.map +1 -1
  255. package/build/esm/modules/NavigationView/NavigationView.d.ts +1 -1
  256. package/build/esm/modules/NavigationView/NavigationView.js +2 -1
  257. package/build/esm/modules/NavigationView/NavigationView.js.map +1 -1
  258. package/build/esm/modules/NavigationView/helpers/buildViewColumns.d.ts +1 -1
  259. package/build/esm/modules/NavigationView/helpers/buildViewColumns.js.map +1 -1
  260. package/build/esm/modules/NavigationView/internal/NavigationViewSectionItem.d.ts +1 -1
  261. package/build/esm/modules/NavigationView/internal/NavigationViewSectionItem.js +2 -1
  262. package/build/esm/modules/NavigationView/internal/NavigationViewSectionItem.js.map +1 -1
  263. package/build/esm/modules/QueriesList/QueriesList.js +1 -1
  264. package/build/esm/modules/QueriesList/QueriesList.js.map +1 -1
  265. package/build/esm/modules/QueryProgress/QueryProgress.css +64 -0
  266. package/build/esm/modules/QueryProgress/QueryProgress.css.map +1 -0
  267. package/build/esm/modules/QueryProgress/QueryProgress.d.ts +4 -0
  268. package/build/esm/modules/QueryProgress/QueryProgress.js +127 -0
  269. package/build/esm/modules/QueryProgress/QueryProgress.js.map +1 -0
  270. package/build/esm/modules/QueryProgress/QueryProgress.scss +72 -0
  271. package/build/esm/modules/QueryProgress/QueryProgress.stories.d.ts +7 -0
  272. package/build/esm/modules/QueryProgress/QueryProgress.stories.js +31 -0
  273. package/build/esm/modules/QueryProgress/QueryProgress.stories.js.map +1 -0
  274. package/build/esm/modules/QueryProgress/i18n/dicts.d.ts +25 -0
  275. package/build/esm/modules/QueryProgress/i18n/dicts.js +7 -0
  276. package/build/esm/modules/QueryProgress/i18n/dicts.js.map +1 -0
  277. package/build/esm/modules/QueryProgress/i18n/en.json +11 -0
  278. package/build/esm/modules/QueryProgress/i18n/index.d.ts +6 -0
  279. package/build/esm/modules/QueryProgress/i18n/index.js +4 -0
  280. package/build/esm/modules/QueryProgress/i18n/index.js.map +1 -0
  281. package/build/esm/modules/QueryProgress/i18n/ru.json +11 -0
  282. package/build/esm/modules/QueryProgress/index.d.ts +2 -0
  283. package/build/esm/modules/QueryProgress/index.js +2 -0
  284. package/build/esm/modules/QueryProgress/index.js.map +1 -0
  285. package/build/esm/modules/QueryStatistics/i18n/index.d.ts +2 -2
  286. package/build/esm/modules/RowsList/RowsList.js +2 -1
  287. package/build/esm/modules/RowsList/RowsList.js.map +1 -1
  288. package/build/esm/modules/SavedQueryRow/SavedQueryRow.d.ts +2 -2
  289. package/build/esm/modules/SavedQueryRow/SavedQueryRow.js +3 -1
  290. package/build/esm/modules/SavedQueryRow/SavedQueryRow.js.map +1 -1
  291. package/build/esm/modules/SavedQuerySearchRow/SavedQuerySearchRow.d.ts +2 -2
  292. package/build/esm/modules/SavedQuerySearchRow/SavedQuerySearchRow.js +2 -1
  293. package/build/esm/modules/SavedQuerySearchRow/SavedQuerySearchRow.js.map +1 -1
  294. package/build/esm/modules/TutorialRow/TutorialRow.d.ts +1 -1
  295. package/build/esm/modules/TutorialRow/TutorialRow.js +1 -1
  296. package/build/esm/modules/TutorialRow/TutorialRow.js.map +1 -1
  297. package/build/esm/modules/TutorialSearchRow/TutorialSearchRow.d.ts +1 -1
  298. package/build/esm/modules/TutorialSearchRow/TutorialSearchRow.js +2 -1
  299. package/build/esm/modules/TutorialSearchRow/TutorialSearchRow.js.map +1 -1
  300. package/build/esm/modules/index.d.ts +2 -0
  301. package/build/esm/modules/index.js +1 -0
  302. package/build/esm/modules/index.js.map +1 -1
  303. package/build/esm/types/queryGraph.d.ts +87 -0
  304. package/build/esm/types/queryGraph.js +2 -0
  305. package/build/esm/types/queryGraph.js.map +1 -0
  306. package/build/esm/widgets/DashboardCharts/DashboardCharts.js +4 -2
  307. package/build/esm/widgets/DashboardCharts/DashboardCharts.js.map +1 -1
  308. package/build/esm/widgets/DashboardCharts/types.d.ts +3 -3
  309. package/build/esm/widgets/DashboardCharts/types.js.map +1 -1
  310. package/build/esm/widgets/QueriesHistory/QueriesHistory.js +1 -1
  311. package/build/esm/widgets/QueriesHistory/QueriesHistory.js.map +1 -1
  312. package/build/esm/widgets/QueriesHistory/internal/HistoryRowContent.js +3 -2
  313. package/build/esm/widgets/QueriesHistory/internal/HistoryRowContent.js.map +1 -1
  314. package/build/esm/widgets/QueriesNavigation/QueriesNavigation.d.ts +1 -1
  315. package/build/esm/widgets/QueriesNavigation/QueriesNavigation.js +6 -2
  316. package/build/esm/widgets/QueriesNavigation/QueriesNavigation.js.map +1 -1
  317. package/build/esm/widgets/QueriesNavigation/helpers/createEmptyDetailConfig.js +1 -1
  318. package/build/esm/widgets/QueriesNavigation/helpers/createEmptyDetailConfig.js.map +1 -1
  319. package/build/esm/widgets/QueriesNavigation/helpers/createTableDetailConfig.js +4 -1
  320. package/build/esm/widgets/QueriesNavigation/helpers/createTableDetailConfig.js.map +1 -1
  321. package/build/esm/widgets/QueryResults/QueryResults.js +1 -1
  322. package/build/esm/widgets/QueryResults/QueryResults.js.map +1 -1
  323. package/build/esm/widgets/QueryResults/i18n/index.d.ts +2 -2
  324. package/build/esm/widgets/QueryResults/internal/QueryResultsSchema.js +2 -1
  325. package/build/esm/widgets/QueryResults/internal/QueryResultsSchema.js.map +1 -1
  326. package/build/esm/widgets/SavedQueries/SavedQueries.d.ts +2 -2
  327. package/build/esm/widgets/SavedQueries/SavedQueries.js +1 -1
  328. package/build/esm/widgets/SavedQueries/SavedQueries.js.map +1 -1
  329. package/build/esm/widgets/SavedQueries/SavedQueryRowContent.d.ts +2 -2
  330. package/build/esm/widgets/SavedQueries/SavedQueryRowContent.js +3 -2
  331. package/build/esm/widgets/SavedQueries/SavedQueryRowContent.js.map +1 -1
  332. package/build/esm/widgets/TutorialsHistory/TutorialRowContent.d.ts +2 -2
  333. package/build/esm/widgets/TutorialsHistory/TutorialRowContent.js +3 -2
  334. package/build/esm/widgets/TutorialsHistory/TutorialRowContent.js.map +1 -1
  335. package/build/esm/widgets/TutorialsHistory/TutorialsHistory.d.ts +2 -2
  336. package/build/esm/widgets/TutorialsHistory/TutorialsHistory.js +3 -1
  337. package/build/esm/widgets/TutorialsHistory/TutorialsHistory.js.map +1 -1
  338. package/package.json +84 -5
@@ -0,0 +1,70 @@
1
+ .qp-query-graph {
2
+ position: relative;
3
+ min-height: 360px;
4
+ height: 100%;
5
+ overflow: hidden;
6
+ background: var(--g-color-base-background);
7
+ }
8
+ .qp-query-graph__canvas {
9
+ width: 100%;
10
+ height: 100%;
11
+ min-height: 360px;
12
+ }
13
+ .qp-query-graph__toolbox {
14
+ position: absolute;
15
+ z-index: 4;
16
+ top: var(--g-spacing-4);
17
+ left: var(--g-spacing-4);
18
+ display: flex;
19
+ width: 28px;
20
+ flex-direction: column;
21
+ }
22
+ .qp-query-graph__popup {
23
+ position: absolute;
24
+ z-index: 5;
25
+ width: min(440px, 100% - var(--g-spacing-8));
26
+ max-height: calc(100% - var(--g-spacing-8));
27
+ overflow: auto;
28
+ padding: var(--g-spacing-4);
29
+ border: 1px solid var(--g-color-line-generic);
30
+ border-radius: var(--g-border-radius-l);
31
+ box-shadow: 0 4px 24px var(--g-color-sfx-shadow);
32
+ background: var(--g-color-base-float);
33
+ }
34
+ .qp-query-graph__popup-content, .qp-query-graph__jobs, .qp-query-graph__schemas, .qp-query-graph__details {
35
+ display: flex;
36
+ flex-direction: column;
37
+ gap: var(--g-spacing-3);
38
+ }
39
+ .qp-query-graph__popup-title {
40
+ display: flex;
41
+ align-items: center;
42
+ gap: var(--g-spacing-2);
43
+ }
44
+ .qp-query-graph__popup-title > div {
45
+ display: flex;
46
+ min-width: 0;
47
+ flex-direction: column;
48
+ }
49
+ .qp-query-graph__detail-row {
50
+ display: flex;
51
+ justify-content: space-between;
52
+ gap: var(--g-spacing-3);
53
+ }
54
+ .qp-query-graph__state {
55
+ height: 100%;
56
+ min-height: 360px;
57
+ display: flex;
58
+ align-items: center;
59
+ justify-content: center;
60
+ padding: var(--g-spacing-6);
61
+ text-align: center;
62
+ }
63
+ .qp-query-graph__large-graph {
64
+ display: flex;
65
+ max-width: 480px;
66
+ flex-direction: column;
67
+ align-items: center;
68
+ gap: var(--g-spacing-4);
69
+ }
70
+ /*# sourceMappingURL=QueryGraph.css.map */
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["QueryGraph.scss"],"names":[],"mappings":"AAAA;EACI,kBAAA;EACA,iBAAA;EACA,YAAA;EACA,gBAAA;EACA,0CAAA;AACJ;AACI;EACI,WAAA;EACA,YAAA;EACA,iBAAA;AACR;AAEI;EACI,kBAAA;EACA,UAAA;EACA,uBAAA;EACA,wBAAA;EACA,aAAA;EACA,WAAA;EACA,sBAAA;AAAR;AAGI;EACI,kBAAA;EACA,UAAA;EACA,4CAAA;EACA,2CAAA;EACA,cAAA;EACA,2BAAA;EACA,6CAAA;EACA,uCAAA;EACA,gDAAA;EACA,qCAAA;AADR;AAII;EAII,aAAA;EACA,sBAAA;EACA,uBAAA;AALR;AAQI;EACI,aAAA;EACA,mBAAA;EACA,uBAAA;AANR;AAQQ;EACI,aAAA;EACA,YAAA;EACA,sBAAA;AANZ;AAUI;EACI,aAAA;EACA,8BAAA;EACA,uBAAA;AARR;AAWI;EACI,YAAA;EACA,iBAAA;EACA,aAAA;EACA,mBAAA;EACA,uBAAA;EACA,2BAAA;EACA,kBAAA;AATR;AAYI;EACI,aAAA;EACA,gBAAA;EACA,sBAAA;EACA,mBAAA;EACA,uBAAA;AAVR","file":"QueryGraph.css","sourcesContent":[".qp-query-graph {\n position: relative;\n min-height: 360px;\n height: 100%;\n overflow: hidden;\n background: var(--g-color-base-background);\n\n &__canvas {\n width: 100%;\n height: 100%;\n min-height: 360px;\n }\n\n &__toolbox {\n position: absolute;\n z-index: 4;\n top: var(--g-spacing-4);\n left: var(--g-spacing-4);\n display: flex;\n width: 28px;\n flex-direction: column;\n }\n\n &__popup {\n position: absolute;\n z-index: 5;\n width: min(440px, calc(100% - var(--g-spacing-8)));\n max-height: calc(100% - var(--g-spacing-8));\n overflow: auto;\n padding: var(--g-spacing-4);\n border: 1px solid var(--g-color-line-generic);\n border-radius: var(--g-border-radius-l);\n box-shadow: 0 4px 24px var(--g-color-sfx-shadow);\n background: var(--g-color-base-float);\n }\n\n &__popup-content,\n &__jobs,\n &__schemas,\n &__details {\n display: flex;\n flex-direction: column;\n gap: var(--g-spacing-3);\n }\n\n &__popup-title {\n display: flex;\n align-items: center;\n gap: var(--g-spacing-2);\n\n > div {\n display: flex;\n min-width: 0;\n flex-direction: column;\n }\n }\n\n &__detail-row {\n display: flex;\n justify-content: space-between;\n gap: var(--g-spacing-3);\n }\n\n &__state {\n height: 100%;\n min-height: 360px;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: var(--g-spacing-6);\n text-align: center;\n }\n\n &__large-graph {\n display: flex;\n max-width: 480px;\n flex-direction: column;\n align-items: center;\n gap: var(--g-spacing-4);\n }\n}\n"],"sourceRoot":""}
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import type { QueryGraphProps } from '../../types/queryGraph';
3
+ import './QueryGraph.scss';
4
+ export declare function QueryGraph({ nodes, edges, loading, errorContent, className, autoCenter, active, largeGraphThreshold, renderNodePopup, onNodeClick, onError, }: QueryGraphProps): React.JSX.Element;
@@ -0,0 +1,510 @@
1
+ import _objectSpread from "@babel/runtime/helpers/objectSpread2";
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
+ import "core-js/modules/es.error.cause.js";
4
+ import "core-js/modules/es.error.to-string.js";
5
+ import "core-js/modules/es.array.concat.js";
6
+ import "core-js/modules/es.array.find.js";
7
+ import "core-js/modules/es.array.flat-map.js";
8
+ import "core-js/modules/es.array.join.js";
9
+ import "core-js/modules/es.array.map.js";
10
+ import "core-js/modules/es.array.unscopables.flat-map.js";
11
+ import "core-js/modules/es.function.name.js";
12
+ import "core-js/modules/es.iterator.constructor.js";
13
+ import "core-js/modules/es.iterator.find.js";
14
+ import "core-js/modules/es.iterator.flat-map.js";
15
+ import "core-js/modules/es.iterator.map.js";
16
+ import "core-js/modules/es.object.to-string.js";
17
+ import "core-js/modules/es.string.trim.js";
18
+ import React, { useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
19
+ import { BezierMultipointConnection, ECanDrag, GraphState } from '@gravity-ui/graph';
20
+ import { GraphCanvas, useGraph, useGraphEvent } from '@gravity-ui/graph/react';
21
+ import { MagnifierMinus, MagnifierPlus, SquareDashed } from '@gravity-ui/icons';
22
+ import { Button, Icon, Loader, Text, Tooltip, useThemeValue } from '@gravity-ui/uikit';
23
+ import cn from 'bem-cn-lite';
24
+ import { createQueryGraphConnections, getQueryGraphNodeSize, validateQueryGraph } from "./helpers/layout";
25
+ import i18n from "./i18n";
26
+ import { QueryGraphCanvasBlock } from "./internal/QueryGraphCanvasBlock";
27
+ import { QueryGraphPopup } from "./internal/QueryGraphPopup";
28
+ import { getQueryGraphNodeIconSvgs } from "./internal/queryGraphIcons";
29
+ import { useQueryGraphLayout } from "./internal/useQueryGraphLayout";
30
+ import "./QueryGraph.css";
31
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
32
+ var block = cn('qp-query-graph');
33
+ var FIT_PADDING = 120;
34
+ var ZOOM_STEP = 0.08;
35
+ var renderEmptyBlock = function renderEmptyBlock() {
36
+ return /*#__PURE__*/_jsx(React.Fragment, {});
37
+ };
38
+ export function QueryGraph(_ref) {
39
+ var nodes = _ref.nodes,
40
+ edges = _ref.edges,
41
+ loading = _ref.loading,
42
+ errorContent = _ref.errorContent,
43
+ className = _ref.className,
44
+ _ref$autoCenter = _ref.autoCenter,
45
+ autoCenter = _ref$autoCenter === void 0 ? true : _ref$autoCenter,
46
+ _ref$active = _ref.active,
47
+ active = _ref$active === void 0 ? true : _ref$active,
48
+ _ref$largeGraphThresh = _ref.largeGraphThreshold,
49
+ largeGraphThreshold = _ref$largeGraphThresh === void 0 ? 250 : _ref$largeGraphThresh,
50
+ renderNodePopup = _ref.renderNodePopup,
51
+ onNodeClick = _ref.onNodeClick,
52
+ onError = _ref.onError;
53
+ var _useState = useState(false),
54
+ _useState2 = _slicedToArray(_useState, 2),
55
+ showLargeGraph = _useState2[0],
56
+ setShowLargeGraph = _useState2[1];
57
+ var nodesRef = useRef(nodes);
58
+ var edgesRef = useRef(edges);
59
+ nodesRef.current = nodes;
60
+ edgesRef.current = edges;
61
+ var structureKey = useMemo(function () {
62
+ return "".concat(nodes.map(function (_ref2) {
63
+ var id = _ref2.id,
64
+ kind = _ref2.kind;
65
+ return "".concat(id, ":").concat(kind);
66
+ }).join('|'), "::").concat(edges.map(function (_ref3) {
67
+ var id = _ref3.id,
68
+ source = _ref3.source,
69
+ target = _ref3.target;
70
+ return "".concat(id, ":").concat(source, ":").concat(target);
71
+ }).join('|'));
72
+ }, [edges, nodes]);
73
+ var validationError = useMemo(function () {
74
+ try {
75
+ validateQueryGraph(nodesRef.current, edgesRef.current);
76
+ return undefined;
77
+ } catch (nextError) {
78
+ return nextError instanceof Error ? nextError : new Error('Unable to build query graph');
79
+ }
80
+ // Only graph structure affects validation.
81
+ // eslint-disable-next-line react-hooks/exhaustive-deps
82
+ }, [structureKey]);
83
+ useEffect(function () {
84
+ if (validationError) onError === null || onError === void 0 || onError(validationError);
85
+ }, [onError, validationError]);
86
+ var shouldConfirm = largeGraphThreshold !== false && nodes.length > largeGraphThreshold;
87
+ if (loading) return /*#__PURE__*/_jsx(State, {
88
+ className: className,
89
+ children: /*#__PURE__*/_jsx(Loader, {
90
+ size: "m"
91
+ })
92
+ });
93
+ if (errorContent) return /*#__PURE__*/_jsx(State, {
94
+ className: className,
95
+ children: /*#__PURE__*/_jsx(Text, {
96
+ color: "danger",
97
+ children: errorContent
98
+ })
99
+ });
100
+ if (validationError) return /*#__PURE__*/_jsx(State, {
101
+ className: className,
102
+ children: /*#__PURE__*/_jsx(Text, {
103
+ color: "danger",
104
+ children: validationError.message
105
+ })
106
+ });
107
+ if (!nodes.length) return /*#__PURE__*/_jsx(State, {
108
+ className: className,
109
+ children: /*#__PURE__*/_jsx(Text, {
110
+ color: "secondary",
111
+ children: i18n('context_empty')
112
+ })
113
+ });
114
+ if (shouldConfirm && !showLargeGraph) {
115
+ return /*#__PURE__*/_jsx(State, {
116
+ className: className,
117
+ children: /*#__PURE__*/_jsxs("div", {
118
+ className: block('large-graph'),
119
+ children: [/*#__PURE__*/_jsx(Text, {
120
+ children: i18n('context_large-graph', {
121
+ count: nodes.length
122
+ })
123
+ }), /*#__PURE__*/_jsx(Button, {
124
+ view: "action",
125
+ onClick: function onClick() {
126
+ return setShowLargeGraph(true);
127
+ },
128
+ children: i18n('action_show-graph')
129
+ })]
130
+ })
131
+ });
132
+ }
133
+ return /*#__PURE__*/_jsx(QueryGraphWithLayout, {
134
+ nodes: nodes,
135
+ edges: edges,
136
+ structureKey: structureKey,
137
+ autoCenter: autoCenter,
138
+ active: active,
139
+ renderNodePopup: renderNodePopup,
140
+ onNodeClick: onNodeClick,
141
+ onError: onError,
142
+ className: className
143
+ });
144
+ }
145
+ function QueryGraphWithLayout(_ref4) {
146
+ var nodes = _ref4.nodes,
147
+ edges = _ref4.edges,
148
+ structureKey = _ref4.structureKey,
149
+ autoCenter = _ref4.autoCenter,
150
+ active = _ref4.active,
151
+ renderNodePopup = _ref4.renderNodePopup,
152
+ onNodeClick = _ref4.onNodeClick,
153
+ onError = _ref4.onError,
154
+ className = _ref4.className;
155
+ var _useState3 = useState(),
156
+ _useState4 = _slicedToArray(_useState3, 2),
157
+ popup = _useState4[0],
158
+ setPopup = _useState4[1];
159
+ var rootRef = useRef(null);
160
+ var nodesRef = useRef(nodes);
161
+ var edgesRef = useRef(edges);
162
+ nodesRef.current = nodes;
163
+ edgesRef.current = edges;
164
+ var layoutBlocks = useMemo(function () {
165
+ return nodesRef.current.map(function (node) {
166
+ return _objectSpread({
167
+ id: node.id
168
+ }, getQueryGraphNodeSize(node));
169
+ });
170
+ },
171
+ // Node status and presentation do not affect layout.
172
+ // eslint-disable-next-line react-hooks/exhaustive-deps
173
+ [structureKey]);
174
+ var layoutConnections = useMemo(function () {
175
+ return edgesRef.current.map(function (edge) {
176
+ return {
177
+ id: edge.id,
178
+ sourceBlockId: edge.source,
179
+ targetBlockId: edge.target
180
+ };
181
+ });
182
+ },
183
+ // Only graph structure affects layout.
184
+ // eslint-disable-next-line react-hooks/exhaustive-deps
185
+ [structureKey]);
186
+ var _useQueryGraphLayout = useQueryGraphLayout({
187
+ structureKey: structureKey,
188
+ blocks: layoutBlocks,
189
+ connections: layoutConnections,
190
+ onError: onError
191
+ }),
192
+ result = _useQueryGraphLayout.result,
193
+ resolvedStructureKey = _useQueryGraphLayout.resolvedStructureKey,
194
+ isInitialLoading = _useQueryGraphLayout.isInitialLoading,
195
+ error = _useQueryGraphLayout.error;
196
+ var graphBlocks = useMemo(function () {
197
+ return nodes.flatMap(function (node) {
198
+ var position = result === null || result === void 0 ? void 0 : result.blocks[node.id];
199
+ if (!position) return [];
200
+ var _getQueryGraphNodeIco = getQueryGraphNodeIconSvgs(node),
201
+ iconSvg = _getQueryGraphNodeIco.iconSvg,
202
+ fallbackIconSvg = _getQueryGraphNodeIco.fallbackIconSvg,
203
+ iconColorToken = _getQueryGraphNodeIco.iconColorToken,
204
+ fallbackIconColorToken = _getQueryGraphNodeIco.fallbackIconColorToken;
205
+ return [_objectSpread(_objectSpread({
206
+ id: node.id,
207
+ is: 'query-node',
208
+ name: node.name,
209
+ selected: false,
210
+ anchors: [],
211
+ meta: {
212
+ node: node,
213
+ iconSvg: iconSvg,
214
+ fallbackIconSvg: fallbackIconSvg,
215
+ iconColorToken: iconColorToken,
216
+ fallbackIconColorToken: fallbackIconColorToken
217
+ }
218
+ }, getQueryGraphNodeSize(node)), position)];
219
+ });
220
+ }, [nodes, result]);
221
+ var graphConnections = useMemo(function () {
222
+ return createQueryGraphConnections(edges, result === null || result === void 0 ? void 0 : result.edges);
223
+ }, [edges, result]);
224
+ if (error) return /*#__PURE__*/_jsx(State, {
225
+ className: className,
226
+ children: /*#__PURE__*/_jsx(Text, {
227
+ color: "danger",
228
+ children: error.message
229
+ })
230
+ });
231
+ if (isInitialLoading || !result || !resolvedStructureKey) return /*#__PURE__*/_jsx(State, {
232
+ className: className,
233
+ children: /*#__PURE__*/_jsx(Loader, {
234
+ size: "m"
235
+ })
236
+ });
237
+ return (
238
+ /*#__PURE__*/
239
+ // The renderer is declared below to keep the public component and its states together.
240
+ // eslint-disable-next-line @typescript-eslint/no-use-before-define
241
+ _jsx(QueryGraphRenderer, {
242
+ ref: rootRef,
243
+ blocks: graphBlocks,
244
+ connections: graphConnections,
245
+ nodes: nodes,
246
+ structureKey: resolvedStructureKey,
247
+ autoCenter: autoCenter,
248
+ active: active,
249
+ popup: popup,
250
+ setPopup: setPopup,
251
+ renderNodePopup: renderNodePopup,
252
+ onNodeClick: onNodeClick,
253
+ className: className
254
+ })
255
+ );
256
+ }
257
+ var QueryGraphRenderer = /*#__PURE__*/React.forwardRef(function QueryGraphRendererComponent(_ref5, forwardedRef) {
258
+ var blocks = _ref5.blocks,
259
+ connections = _ref5.connections,
260
+ nodes = _ref5.nodes,
261
+ structureKey = _ref5.structureKey,
262
+ autoCenter = _ref5.autoCenter,
263
+ active = _ref5.active,
264
+ popup = _ref5.popup,
265
+ setPopup = _ref5.setPopup,
266
+ renderNodePopup = _ref5.renderNodePopup,
267
+ onNodeClick = _ref5.onNodeClick,
268
+ className = _ref5.className;
269
+ var rootRef = useRef(null);
270
+ useImperativeHandle(forwardedRef, function () {
271
+ return rootRef.current;
272
+ });
273
+ var attachedRef = useRef(false);
274
+ var centeredRef = useRef(false);
275
+ var previousActiveRef = useRef(false);
276
+ var previousStructureRef = useRef(structureKey);
277
+ var _useState5 = useState(false),
278
+ _useState6 = _slicedToArray(_useState5, 2),
279
+ attached = _useState6[0],
280
+ setAttached = _useState6[1];
281
+ var _useState7 = useState(),
282
+ _useState8 = _slicedToArray(_useState7, 2),
283
+ hoveredNodeId = _useState8[0],
284
+ setHoveredNodeId = _useState8[1];
285
+ var themeValue = useThemeValue();
286
+ var _useGraph = useGraph({
287
+ name: 'query-graph',
288
+ settings: {
289
+ connection: BezierMultipointConnection,
290
+ canDrag: ECanDrag.NONE,
291
+ canDragCamera: true,
292
+ canZoomCamera: true,
293
+ canCreateNewConnections: false,
294
+ useBezierConnections: true,
295
+ bezierConnectionDirection: 'horizontal',
296
+ showConnectionArrows: true,
297
+ useBlocksAnchors: false,
298
+ blockComponents: {
299
+ 'query-node': QueryGraphCanvasBlock
300
+ }
301
+ }
302
+ }),
303
+ graph = _useGraph.graph,
304
+ api = _useGraph.api,
305
+ setEntities = _useGraph.setEntities,
306
+ start = _useGraph.start,
307
+ stop = _useGraph.stop;
308
+ var _useState9 = useState(graph.cameraService.getCameraState().scale),
309
+ _useState0 = _slicedToArray(_useState9, 2),
310
+ scale = _useState0[0],
311
+ setScale = _useState0[1];
312
+ var _graph$cameraService$ = graph.cameraService.getCameraState(),
313
+ scaleMin = _graph$cameraService$.scaleMin,
314
+ scaleMax = _graph$cameraService$.scaleMax;
315
+ useGraphEvent(graph, 'camera-change', function (_ref6) {
316
+ var nextScale = _ref6.scale;
317
+ return setScale(nextScale);
318
+ });
319
+ useGraphEvent(graph, 'mouseenter', function (_ref7) {
320
+ var _state$meta;
321
+ var target = _ref7.target;
322
+ var state = target === null || target === void 0 ? void 0 : target.state;
323
+ if (state !== null && state !== void 0 && (_state$meta = state.meta) !== null && _state$meta !== void 0 && _state$meta.node) setHoveredNodeId(state.meta.node.id);
324
+ });
325
+ useGraphEvent(graph, 'mouseleave', function (_ref8) {
326
+ var _state$meta2;
327
+ var target = _ref8.target;
328
+ var state = target === null || target === void 0 ? void 0 : target.state;
329
+ if (state !== null && state !== void 0 && (_state$meta2 = state.meta) !== null && _state$meta2 !== void 0 && _state$meta2.node) setHoveredNodeId(undefined);
330
+ });
331
+ useEffect(function () {
332
+ if (!rootRef.current) return;
333
+ var background = getComputedStyle(rootRef.current).getPropertyValue('--g-color-base-background').trim();
334
+ var connection = getComputedStyle(rootRef.current).getPropertyValue('--g-color-line-generic-accent').trim();
335
+ if (!background || !connection) return;
336
+ var colors = api.getGraphColors();
337
+ api.updateGraphColors(_objectSpread(_objectSpread({}, colors), {}, {
338
+ canvas: _objectSpread(_objectSpread({}, colors.canvas), {}, {
339
+ belowLayerBackground: background,
340
+ layerBackground: background,
341
+ border: background,
342
+ dots: background
343
+ }),
344
+ connection: _objectSpread(_objectSpread({}, colors.connection), {}, {
345
+ background: connection
346
+ })
347
+ }));
348
+ }, [api, themeValue]);
349
+ var visibleConnections = useMemo(function () {
350
+ return connections.map(function (connection) {
351
+ return _objectSpread(_objectSpread({}, connection), {}, {
352
+ selected: Boolean(hoveredNodeId && (connection.sourceBlockId === hoveredNodeId || connection.targetBlockId === hoveredNodeId))
353
+ });
354
+ });
355
+ }, [connections, hoveredNodeId]);
356
+ useEffect(function () {
357
+ return setEntities({
358
+ blocks: blocks,
359
+ connections: visibleConnections
360
+ });
361
+ }, [blocks, setEntities, visibleConnections]);
362
+ useEffect(function () {
363
+ if (!attachedRef.current) return;
364
+ if (active) start();else stop();
365
+ }, [active, start, stop]);
366
+ useEffect(function () {
367
+ var changed = previousStructureRef.current !== structureKey;
368
+ var becameActive = active && !previousActiveRef.current;
369
+ var frame;
370
+ if (attached && active && (!centeredRef.current || becameActive || autoCenter && changed)) {
371
+ frame = requestAnimationFrame(function () {
372
+ api.zoomToViewPort({
373
+ padding: FIT_PADDING
374
+ });
375
+ centeredRef.current = true;
376
+ });
377
+ }
378
+ previousActiveRef.current = Boolean(active);
379
+ previousStructureRef.current = structureKey;
380
+ setPopup(undefined);
381
+ return function () {
382
+ if (frame !== undefined) cancelAnimationFrame(frame);
383
+ };
384
+ }, [active, api, attached, autoCenter, setPopup, structureKey]);
385
+ var handleClick = function handleClick(_ref9) {
386
+ var _state$meta3;
387
+ var target = _ref9.target,
388
+ sourceEvent = _ref9.sourceEvent;
389
+ var state = target === null || target === void 0 ? void 0 : target.state;
390
+ if (!(state !== null && state !== void 0 && (_state$meta3 = state.meta) !== null && _state$meta3 !== void 0 && _state$meta3.node) || !rootRef.current) {
391
+ setPopup(undefined);
392
+ return;
393
+ }
394
+ var mouseEvent = sourceEvent;
395
+ var rect = rootRef.current.getBoundingClientRect();
396
+ var left = Math.min(Math.max(16, mouseEvent.clientX - rect.left + 12), rect.width - 456);
397
+ var top = Math.min(Math.max(16, mouseEvent.clientY - rect.top + 12), rect.height - 240);
398
+ setPopup({
399
+ nodeId: state.meta.node.id,
400
+ left: Math.max(16, left),
401
+ top: Math.max(16, top)
402
+ });
403
+ onNodeClick === null || onNodeClick === void 0 || onNodeClick(state.meta.node, mouseEvent);
404
+ };
405
+ var selectedNode = popup ? nodes.find(function (node) {
406
+ return node.id === popup.nodeId;
407
+ }) : undefined;
408
+ var defaultContent = selectedNode ? /*#__PURE__*/_jsx(QueryGraphPopup, {
409
+ node: selectedNode
410
+ }) : null;
411
+ var popupContent = null;
412
+ if (selectedNode) {
413
+ popupContent = renderNodePopup ? renderNodePopup({
414
+ node: selectedNode,
415
+ defaultContent: defaultContent
416
+ }) : defaultContent;
417
+ }
418
+ return /*#__PURE__*/_jsxs("div", {
419
+ ref: rootRef,
420
+ className: block(null, className),
421
+ children: [/*#__PURE__*/_jsx(GraphCanvas, {
422
+ graph: graph,
423
+ className: block('canvas'),
424
+ click: handleClick,
425
+ renderBlock: renderEmptyBlock,
426
+ onStateChanged: function onStateChanged(_ref0) {
427
+ var state = _ref0.state;
428
+ if (state === GraphState.ATTACHED) {
429
+ if (active) start();
430
+ attachedRef.current = true;
431
+ setAttached(true);
432
+ }
433
+ }
434
+ }), /*#__PURE__*/_jsxs("div", {
435
+ className: block('toolbox'),
436
+ children: [/*#__PURE__*/_jsx(Tooltip, {
437
+ content: i18n('action_zoom-in'),
438
+ placement: "right",
439
+ children: /*#__PURE__*/_jsx(Button, {
440
+ view: "raised",
441
+ pin: "round-brick",
442
+ "aria-label": i18n('action_zoom-in'),
443
+ disabled: scale >= scaleMax,
444
+ onClick: function onClick() {
445
+ return changeZoom(graph, ZOOM_STEP);
446
+ },
447
+ children: /*#__PURE__*/_jsx(Icon, {
448
+ data: MagnifierPlus
449
+ })
450
+ })
451
+ }), /*#__PURE__*/_jsx(Tooltip, {
452
+ content: i18n('action_fit'),
453
+ placement: "right",
454
+ children: /*#__PURE__*/_jsx(Button, {
455
+ view: "raised",
456
+ pin: "brick-brick",
457
+ "aria-label": i18n('action_fit'),
458
+ onClick: function onClick() {
459
+ return api.zoomToViewPort({
460
+ padding: FIT_PADDING
461
+ });
462
+ },
463
+ children: /*#__PURE__*/_jsx(Icon, {
464
+ data: SquareDashed
465
+ })
466
+ })
467
+ }), /*#__PURE__*/_jsx(Tooltip, {
468
+ content: i18n('action_zoom-out'),
469
+ placement: "right",
470
+ children: /*#__PURE__*/_jsx(Button, {
471
+ view: "raised",
472
+ pin: "brick-round",
473
+ "aria-label": i18n('action_zoom-out'),
474
+ disabled: scale <= scaleMin,
475
+ onClick: function onClick() {
476
+ return changeZoom(graph, -ZOOM_STEP);
477
+ },
478
+ children: /*#__PURE__*/_jsx(Icon, {
479
+ data: MagnifierMinus
480
+ })
481
+ })
482
+ })]
483
+ }), popup && popupContent !== null && /*#__PURE__*/_jsx("div", {
484
+ className: block('popup'),
485
+ style: {
486
+ left: popup.left,
487
+ top: popup.top
488
+ },
489
+ children: popupContent
490
+ })]
491
+ });
492
+ });
493
+ function changeZoom(graph, delta) {
494
+ var camera = graph.cameraService;
495
+ var state = camera.getCameraState();
496
+ var nextScale = Math.min(state.scaleMax, Math.max(state.scaleMin, state.scale + delta));
497
+ camera.zoom(state.width / 2, state.height / 2, nextScale);
498
+ }
499
+ function State(_ref1) {
500
+ var className = _ref1.className,
501
+ children = _ref1.children;
502
+ return /*#__PURE__*/_jsx("div", {
503
+ className: block(null, className),
504
+ children: /*#__PURE__*/_jsx("div", {
505
+ className: block('state'),
506
+ children: children
507
+ })
508
+ });
509
+ }
510
+ // #sourceMappingURL=QueryGraph.js.map