@finos/legend-cube-builder 0.0.0-stage → 0.0.3

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 (379) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +64 -2
  3. package/docs/adding-an-operation.md +92 -0
  4. package/docs/hosting.md +79 -0
  5. package/docs/testing.md +83 -0
  6. package/lib/__lib__/LegendCubeCommand.d.ts +26 -0
  7. package/lib/__lib__/LegendCubeCommand.d.ts.map +1 -0
  8. package/lib/__lib__/LegendCubeCommand.js +40 -0
  9. package/lib/__lib__/LegendCubeCommand.js.map +1 -0
  10. package/lib/__lib__/LegendCubeHelpText.d.ts +19 -0
  11. package/lib/__lib__/LegendCubeHelpText.d.ts.map +1 -0
  12. package/lib/__lib__/LegendCubeHelpText.js +35 -0
  13. package/lib/__lib__/LegendCubeHelpText.js.map +1 -0
  14. package/lib/__lib__/LegendCubeLabels.d.ts +87 -0
  15. package/lib/__lib__/LegendCubeLabels.d.ts.map +1 -0
  16. package/lib/__lib__/LegendCubeLabels.js +128 -0
  17. package/lib/__lib__/LegendCubeLabels.js.map +1 -0
  18. package/lib/__lib__/LegendCubeTesting.d.ts +33 -0
  19. package/lib/__lib__/LegendCubeTesting.d.ts.map +1 -0
  20. package/lib/__lib__/LegendCubeTesting.js +34 -0
  21. package/lib/__lib__/LegendCubeTesting.js.map +1 -0
  22. package/lib/__test-utils__/CubeCanvasTestUtils.d.ts +24 -0
  23. package/lib/__test-utils__/CubeCanvasTestUtils.d.ts.map +1 -0
  24. package/lib/__test-utils__/CubeCanvasTestUtils.js +37 -0
  25. package/lib/__test-utils__/CubeCanvasTestUtils.js.map +1 -0
  26. package/lib/__test-utils__/CubeEngineTestSupport.d.ts +47 -0
  27. package/lib/__test-utils__/CubeEngineTestSupport.d.ts.map +1 -0
  28. package/lib/__test-utils__/CubeEngineTestSupport.js +106 -0
  29. package/lib/__test-utils__/CubeEngineTestSupport.js.map +1 -0
  30. package/lib/__test-utils__/CubeNorthwindTestQueries.d.ts +31 -0
  31. package/lib/__test-utils__/CubeNorthwindTestQueries.d.ts.map +1 -0
  32. package/lib/__test-utils__/CubeNorthwindTestQueries.js +102 -0
  33. package/lib/__test-utils__/CubeNorthwindTestQueries.js.map +1 -0
  34. package/lib/__test-utils__/CubeOperationsTestUtils.d.ts +42 -0
  35. package/lib/__test-utils__/CubeOperationsTestUtils.d.ts.map +1 -0
  36. package/lib/__test-utils__/CubeOperationsTestUtils.js +92 -0
  37. package/lib/__test-utils__/CubeOperationsTestUtils.js.map +1 -0
  38. package/lib/__test-utils__/CubePageTestUtils.d.ts +33 -0
  39. package/lib/__test-utils__/CubePageTestUtils.d.ts.map +1 -0
  40. package/lib/__test-utils__/CubePageTestUtils.js +68 -0
  41. package/lib/__test-utils__/CubePageTestUtils.js.map +1 -0
  42. package/lib/__test-utils__/CubeTestApplication.d.ts +30 -0
  43. package/lib/__test-utils__/CubeTestApplication.d.ts.map +1 -0
  44. package/lib/__test-utils__/CubeTestApplication.js +57 -0
  45. package/lib/__test-utils__/CubeTestApplication.js.map +1 -0
  46. package/lib/__test-utils__/FakeCubeEngine.d.ts +41 -0
  47. package/lib/__test-utils__/FakeCubeEngine.d.ts.map +1 -0
  48. package/lib/__test-utils__/FakeCubeEngine.js +91 -0
  49. package/lib/__test-utils__/FakeCubeEngine.js.map +1 -0
  50. package/lib/components/CubeButton.d.ts +20 -0
  51. package/lib/components/CubeButton.d.ts.map +1 -0
  52. package/lib/components/CubeButton.js +24 -0
  53. package/lib/components/CubeButton.js.map +1 -0
  54. package/lib/components/CubeEditor.d.ts +31 -0
  55. package/lib/components/CubeEditor.d.ts.map +1 -0
  56. package/lib/components/CubeEditor.js +90 -0
  57. package/lib/components/CubeEditor.js.map +1 -0
  58. package/lib/components/CubeNodeIcon.d.ts +23 -0
  59. package/lib/components/CubeNodeIcon.d.ts.map +1 -0
  60. package/lib/components/CubeNodeIcon.js +42 -0
  61. package/lib/components/CubeNodeIcon.js.map +1 -0
  62. package/lib/components/canvas/CubeCanvas.d.ts +37 -0
  63. package/lib/components/canvas/CubeCanvas.d.ts.map +1 -0
  64. package/lib/components/canvas/CubeCanvas.js +137 -0
  65. package/lib/components/canvas/CubeCanvas.js.map +1 -0
  66. package/lib/components/canvas/CubeCanvasContext.d.ts +19 -0
  67. package/lib/components/canvas/CubeCanvasContext.d.ts.map +1 -0
  68. package/lib/components/canvas/CubeCanvasContext.js +22 -0
  69. package/lib/components/canvas/CubeCanvasContext.js.map +1 -0
  70. package/lib/components/canvas/CubeCanvasContextMenu.d.ts +28 -0
  71. package/lib/components/canvas/CubeCanvasContextMenu.d.ts.map +1 -0
  72. package/lib/components/canvas/CubeCanvasContextMenu.js +35 -0
  73. package/lib/components/canvas/CubeCanvasContextMenu.js.map +1 -0
  74. package/lib/components/canvas/CubeCanvasDnd.d.ts +43 -0
  75. package/lib/components/canvas/CubeCanvasDnd.d.ts.map +1 -0
  76. package/lib/components/canvas/CubeCanvasDnd.js +51 -0
  77. package/lib/components/canvas/CubeCanvasDnd.js.map +1 -0
  78. package/lib/components/canvas/CubeCanvasEdge.d.ts +24 -0
  79. package/lib/components/canvas/CubeCanvasEdge.d.ts.map +1 -0
  80. package/lib/components/canvas/CubeCanvasEdge.js +33 -0
  81. package/lib/components/canvas/CubeCanvasEdge.js.map +1 -0
  82. package/lib/components/canvas/CubeCanvasElements.d.ts +66 -0
  83. package/lib/components/canvas/CubeCanvasElements.d.ts.map +1 -0
  84. package/lib/components/canvas/CubeCanvasElements.js +97 -0
  85. package/lib/components/canvas/CubeCanvasElements.js.map +1 -0
  86. package/lib/components/canvas/CubeCanvasLayout.d.ts +32 -0
  87. package/lib/components/canvas/CubeCanvasLayout.d.ts.map +1 -0
  88. package/lib/components/canvas/CubeCanvasLayout.js +63 -0
  89. package/lib/components/canvas/CubeCanvasLayout.js.map +1 -0
  90. package/lib/components/canvas/CubeCanvasNode.d.ts +29 -0
  91. package/lib/components/canvas/CubeCanvasNode.d.ts.map +1 -0
  92. package/lib/components/canvas/CubeCanvasNode.js +75 -0
  93. package/lib/components/canvas/CubeCanvasNode.js.map +1 -0
  94. package/lib/components/editors/CubeColumnPicker.d.ts +47 -0
  95. package/lib/components/editors/CubeColumnPicker.d.ts.map +1 -0
  96. package/lib/components/editors/CubeColumnPicker.js +56 -0
  97. package/lib/components/editors/CubeColumnPicker.js.map +1 -0
  98. package/lib/components/editors/CubeDistinctEditor.d.ts +23 -0
  99. package/lib/components/editors/CubeDistinctEditor.d.ts.map +1 -0
  100. package/lib/components/editors/CubeDistinctEditor.js +24 -0
  101. package/lib/components/editors/CubeDistinctEditor.js.map +1 -0
  102. package/lib/components/editors/CubeFilterEditor.d.ts +26 -0
  103. package/lib/components/editors/CubeFilterEditor.d.ts.map +1 -0
  104. package/lib/components/editors/CubeFilterEditor.js +90 -0
  105. package/lib/components/editors/CubeFilterEditor.js.map +1 -0
  106. package/lib/components/editors/CubeIntegerField.d.ts +29 -0
  107. package/lib/components/editors/CubeIntegerField.d.ts.map +1 -0
  108. package/lib/components/editors/CubeIntegerField.js +30 -0
  109. package/lib/components/editors/CubeIntegerField.js.map +1 -0
  110. package/lib/components/editors/CubeJoinEditor.d.ts +26 -0
  111. package/lib/components/editors/CubeJoinEditor.d.ts.map +1 -0
  112. package/lib/components/editors/CubeJoinEditor.js +84 -0
  113. package/lib/components/editors/CubeJoinEditor.js.map +1 -0
  114. package/lib/components/editors/CubeNodeEditorPanel.d.ts +29 -0
  115. package/lib/components/editors/CubeNodeEditorPanel.d.ts.map +1 -0
  116. package/lib/components/editors/CubeNodeEditorPanel.js +72 -0
  117. package/lib/components/editors/CubeNodeEditorPanel.js.map +1 -0
  118. package/lib/components/editors/CubeNodeEditorRegistry.d.ts +44 -0
  119. package/lib/components/editors/CubeNodeEditorRegistry.d.ts.map +1 -0
  120. package/lib/components/editors/CubeNodeEditorRegistry.js +43 -0
  121. package/lib/components/editors/CubeNodeEditorRegistry.js.map +1 -0
  122. package/lib/components/editors/CubeRenameEditor.d.ts +26 -0
  123. package/lib/components/editors/CubeRenameEditor.d.ts.map +1 -0
  124. package/lib/components/editors/CubeRenameEditor.js +58 -0
  125. package/lib/components/editors/CubeRenameEditor.js.map +1 -0
  126. package/lib/components/editors/CubeRestrictEditor.d.ts +26 -0
  127. package/lib/components/editors/CubeRestrictEditor.d.ts.map +1 -0
  128. package/lib/components/editors/CubeRestrictEditor.js +23 -0
  129. package/lib/components/editors/CubeRestrictEditor.js.map +1 -0
  130. package/lib/components/editors/CubeRowCountEditor.d.ts +25 -0
  131. package/lib/components/editors/CubeRowCountEditor.d.ts.map +1 -0
  132. package/lib/components/editors/CubeRowCountEditor.js +38 -0
  133. package/lib/components/editors/CubeRowCountEditor.js.map +1 -0
  134. package/lib/components/editors/CubeSliceEditor.d.ts +25 -0
  135. package/lib/components/editors/CubeSliceEditor.d.ts.map +1 -0
  136. package/lib/components/editors/CubeSliceEditor.js +40 -0
  137. package/lib/components/editors/CubeSliceEditor.js.map +1 -0
  138. package/lib/components/editors/CubeSortEditor.d.ts +27 -0
  139. package/lib/components/editors/CubeSortEditor.d.ts.map +1 -0
  140. package/lib/components/editors/CubeSortEditor.js +72 -0
  141. package/lib/components/editors/CubeSortEditor.js.map +1 -0
  142. package/lib/components/editors/CubeSourceEditor.d.ts +25 -0
  143. package/lib/components/editors/CubeSourceEditor.d.ts.map +1 -0
  144. package/lib/components/editors/CubeSourceEditor.js +41 -0
  145. package/lib/components/editors/CubeSourceEditor.js.map +1 -0
  146. package/lib/components/editors/CubeValueEditor.d.ts +40 -0
  147. package/lib/components/editors/CubeValueEditor.d.ts.map +1 -0
  148. package/lib/components/editors/CubeValueEditor.js +178 -0
  149. package/lib/components/editors/CubeValueEditor.js.map +1 -0
  150. package/lib/components/grid/CubeGridRegion.d.ts +23 -0
  151. package/lib/components/grid/CubeGridRegion.d.ts.map +1 -0
  152. package/lib/components/grid/CubeGridRegion.js +94 -0
  153. package/lib/components/grid/CubeGridRegion.js.map +1 -0
  154. package/lib/components/grid/CubeGridValues.d.ts +25 -0
  155. package/lib/components/grid/CubeGridValues.d.ts.map +1 -0
  156. package/lib/components/grid/CubeGridValues.js +95 -0
  157. package/lib/components/grid/CubeGridValues.js.map +1 -0
  158. package/lib/components/grid/CubeResultGrid.d.ts +39 -0
  159. package/lib/components/grid/CubeResultGrid.d.ts.map +1 -0
  160. package/lib/components/grid/CubeResultGrid.js +86 -0
  161. package/lib/components/grid/CubeResultGrid.js.map +1 -0
  162. package/lib/components/palette/CubePalette.d.ts +29 -0
  163. package/lib/components/palette/CubePalette.d.ts.map +1 -0
  164. package/lib/components/palette/CubePalette.js +73 -0
  165. package/lib/components/palette/CubePalette.js.map +1 -0
  166. package/lib/components/show-pure/CubeShowPureDialog.d.ts +23 -0
  167. package/lib/components/show-pure/CubeShowPureDialog.d.ts.map +1 -0
  168. package/lib/components/show-pure/CubeShowPureDialog.js +37 -0
  169. package/lib/components/show-pure/CubeShowPureDialog.js.map +1 -0
  170. package/lib/components/source-picker/CubeSourcePicker.d.ts +22 -0
  171. package/lib/components/source-picker/CubeSourcePicker.d.ts.map +1 -0
  172. package/lib/components/source-picker/CubeSourcePicker.js +89 -0
  173. package/lib/components/source-picker/CubeSourcePicker.js.map +1 -0
  174. package/lib/components/spec-transfer/CubeSpecTransferDialog.d.ts +26 -0
  175. package/lib/components/spec-transfer/CubeSpecTransferDialog.d.ts.map +1 -0
  176. package/lib/components/spec-transfer/CubeSpecTransferDialog.js +45 -0
  177. package/lib/components/spec-transfer/CubeSpecTransferDialog.js.map +1 -0
  178. package/lib/graph-manager/CubeEngine.d.ts +128 -0
  179. package/lib/graph-manager/CubeEngine.d.ts.map +1 -0
  180. package/lib/graph-manager/CubeEngine.js +61 -0
  181. package/lib/graph-manager/CubeEngine.js.map +1 -0
  182. package/lib/graph-manager/CubeModelOutlineHelper.d.ts +33 -0
  183. package/lib/graph-manager/CubeModelOutlineHelper.d.ts.map +1 -0
  184. package/lib/graph-manager/CubeModelOutlineHelper.js +45 -0
  185. package/lib/graph-manager/CubeModelOutlineHelper.js.map +1 -0
  186. package/lib/graph-manager/protocol/pure/CubeEngineBuilder.d.ts +26 -0
  187. package/lib/graph-manager/protocol/pure/CubeEngineBuilder.d.ts.map +1 -0
  188. package/lib/graph-manager/protocol/pure/CubeEngineBuilder.js +22 -0
  189. package/lib/graph-manager/protocol/pure/CubeEngineBuilder.js.map +1 -0
  190. package/lib/graph-manager/protocol/pure/v1/V1_CubeEngineErrors.d.ts +27 -0
  191. package/lib/graph-manager/protocol/pure/v1/V1_CubeEngineErrors.d.ts.map +1 -0
  192. package/lib/graph-manager/protocol/pure/v1/V1_CubeEngineErrors.js +76 -0
  193. package/lib/graph-manager/protocol/pure/v1/V1_CubeEngineErrors.js.map +1 -0
  194. package/lib/graph-manager/protocol/pure/v1/V1_CubeExecutionResultReader.d.ts +27 -0
  195. package/lib/graph-manager/protocol/pure/v1/V1_CubeExecutionResultReader.d.ts.map +1 -0
  196. package/lib/graph-manager/protocol/pure/v1/V1_CubeExecutionResultReader.js +82 -0
  197. package/lib/graph-manager/protocol/pure/v1/V1_CubeExecutionResultReader.js.map +1 -0
  198. package/lib/graph-manager/protocol/pure/v1/V1_CubeLambdaSerializer.d.ts +32 -0
  199. package/lib/graph-manager/protocol/pure/v1/V1_CubeLambdaSerializer.d.ts.map +1 -0
  200. package/lib/graph-manager/protocol/pure/v1/V1_CubeLambdaSerializer.js +195 -0
  201. package/lib/graph-manager/protocol/pure/v1/V1_CubeLambdaSerializer.js.map +1 -0
  202. package/lib/graph-manager/protocol/pure/v1/V1_CubeModelOutlineBuilder.d.ts +20 -0
  203. package/lib/graph-manager/protocol/pure/v1/V1_CubeModelOutlineBuilder.d.ts.map +1 -0
  204. package/lib/graph-manager/protocol/pure/v1/V1_CubeModelOutlineBuilder.js +174 -0
  205. package/lib/graph-manager/protocol/pure/v1/V1_CubeModelOutlineBuilder.js.map +1 -0
  206. package/lib/graph-manager/protocol/pure/v1/V1_CubeRelationTypeAdapter.d.ts +24 -0
  207. package/lib/graph-manager/protocol/pure/v1/V1_CubeRelationTypeAdapter.d.ts.map +1 -0
  208. package/lib/graph-manager/protocol/pure/v1/V1_CubeRelationTypeAdapter.js +43 -0
  209. package/lib/graph-manager/protocol/pure/v1/V1_CubeRelationTypeAdapter.js.map +1 -0
  210. package/lib/graph-manager/protocol/pure/v1/V1_LegendCubeEngine.d.ts +45 -0
  211. package/lib/graph-manager/protocol/pure/v1/V1_LegendCubeEngine.d.ts.map +1 -0
  212. package/lib/graph-manager/protocol/pure/v1/V1_LegendCubeEngine.js +171 -0
  213. package/lib/graph-manager/protocol/pure/v1/V1_LegendCubeEngine.js.map +1 -0
  214. package/lib/graph-manager/protocol/pure/v1/__test-utils__/V1_CubeEngineTestUtils.d.ts +22 -0
  215. package/lib/graph-manager/protocol/pure/v1/__test-utils__/V1_CubeEngineTestUtils.d.ts.map +1 -0
  216. package/lib/graph-manager/protocol/pure/v1/__test-utils__/V1_CubeEngineTestUtils.js +79 -0
  217. package/lib/graph-manager/protocol/pure/v1/__test-utils__/V1_CubeEngineTestUtils.js.map +1 -0
  218. package/lib/index.css +17 -0
  219. package/lib/index.css.map +1 -0
  220. package/lib/index.d.ts +25 -0
  221. package/lib/index.d.ts.map +1 -0
  222. package/lib/index.js +24 -0
  223. package/lib/index.js.map +1 -0
  224. package/lib/stores/CubeEditorState.d.ts +236 -0
  225. package/lib/stores/CubeEditorState.d.ts.map +1 -0
  226. package/lib/stores/CubeEditorState.js +632 -0
  227. package/lib/stores/CubeEditorState.js.map +1 -0
  228. package/lib/stores/CubeExecutionState.d.ts +67 -0
  229. package/lib/stores/CubeExecutionState.d.ts.map +1 -0
  230. package/lib/stores/CubeExecutionState.js +212 -0
  231. package/lib/stores/CubeExecutionState.js.map +1 -0
  232. package/lib/stores/CubeGridQuickActions.d.ts +40 -0
  233. package/lib/stores/CubeGridQuickActions.d.ts.map +1 -0
  234. package/lib/stores/CubeGridQuickActions.js +86 -0
  235. package/lib/stores/CubeGridQuickActions.js.map +1 -0
  236. package/lib/stores/CubeHost.d.ts +31 -0
  237. package/lib/stores/CubeHost.d.ts.map +1 -0
  238. package/lib/stores/CubeHost.js +17 -0
  239. package/lib/stores/CubeHost.js.map +1 -0
  240. package/lib/stores/CubeNodeEditorState.d.ts +103 -0
  241. package/lib/stores/CubeNodeEditorState.d.ts.map +1 -0
  242. package/lib/stores/CubeNodeEditorState.js +262 -0
  243. package/lib/stores/CubeNodeEditorState.js.map +1 -0
  244. package/lib/stores/CubeShowPureState.d.ts +41 -0
  245. package/lib/stores/CubeShowPureState.d.ts.map +1 -0
  246. package/lib/stores/CubeShowPureState.js +100 -0
  247. package/lib/stores/CubeShowPureState.js.map +1 -0
  248. package/lib/stores/CubeSourcePickerState.d.ts +98 -0
  249. package/lib/stores/CubeSourcePickerState.d.ts.map +1 -0
  250. package/lib/stores/CubeSourcePickerState.js +334 -0
  251. package/lib/stores/CubeSourcePickerState.js.map +1 -0
  252. package/lib/stores/CubeSpecTransferState.d.ts +60 -0
  253. package/lib/stores/CubeSpecTransferState.d.ts.map +1 -0
  254. package/lib/stores/CubeSpecTransferState.js +167 -0
  255. package/lib/stores/CubeSpecTransferState.js.map +1 -0
  256. package/lib/stores/LocalModelCatalog.d.ts +37 -0
  257. package/lib/stores/LocalModelCatalog.d.ts.map +1 -0
  258. package/lib/stores/LocalModelCatalog.js +49 -0
  259. package/lib/stores/LocalModelCatalog.js.map +1 -0
  260. package/lib/stores/editors/CubeFilterDraft.d.ts +61 -0
  261. package/lib/stores/editors/CubeFilterDraft.d.ts.map +1 -0
  262. package/lib/stores/editors/CubeFilterDraft.js +186 -0
  263. package/lib/stores/editors/CubeFilterDraft.js.map +1 -0
  264. package/lib/stores/editors/CubeIntegerText.d.ts +24 -0
  265. package/lib/stores/editors/CubeIntegerText.d.ts.map +1 -0
  266. package/lib/stores/editors/CubeIntegerText.js +33 -0
  267. package/lib/stores/editors/CubeIntegerText.js.map +1 -0
  268. package/lib/stores/editors/CubeJoinDraft.d.ts +71 -0
  269. package/lib/stores/editors/CubeJoinDraft.d.ts.map +1 -0
  270. package/lib/stores/editors/CubeJoinDraft.js +145 -0
  271. package/lib/stores/editors/CubeJoinDraft.js.map +1 -0
  272. package/lib/stores/editors/CubeNodeDraft.d.ts +38 -0
  273. package/lib/stores/editors/CubeNodeDraft.d.ts.map +1 -0
  274. package/lib/stores/editors/CubeNodeDraft.js +35 -0
  275. package/lib/stores/editors/CubeNodeDraft.js.map +1 -0
  276. package/lib/stores/editors/CubeNodeDraftRegistry.d.ts +35 -0
  277. package/lib/stores/editors/CubeNodeDraftRegistry.d.ts.map +1 -0
  278. package/lib/stores/editors/CubeNodeDraftRegistry.js +55 -0
  279. package/lib/stores/editors/CubeNodeDraftRegistry.js.map +1 -0
  280. package/lib/stores/editors/CubeRenameDraft.d.ts +44 -0
  281. package/lib/stores/editors/CubeRenameDraft.d.ts.map +1 -0
  282. package/lib/stores/editors/CubeRenameDraft.js +79 -0
  283. package/lib/stores/editors/CubeRenameDraft.js.map +1 -0
  284. package/lib/stores/editors/CubeRestrictDraft.d.ts +37 -0
  285. package/lib/stores/editors/CubeRestrictDraft.d.ts.map +1 -0
  286. package/lib/stores/editors/CubeRestrictDraft.js +73 -0
  287. package/lib/stores/editors/CubeRestrictDraft.js.map +1 -0
  288. package/lib/stores/editors/CubeRowCountDraft.d.ts +42 -0
  289. package/lib/stores/editors/CubeRowCountDraft.d.ts.map +1 -0
  290. package/lib/stores/editors/CubeRowCountDraft.js +55 -0
  291. package/lib/stores/editors/CubeRowCountDraft.js.map +1 -0
  292. package/lib/stores/editors/CubeSliceDraft.d.ts +42 -0
  293. package/lib/stores/editors/CubeSliceDraft.d.ts.map +1 -0
  294. package/lib/stores/editors/CubeSliceDraft.js +72 -0
  295. package/lib/stores/editors/CubeSliceDraft.js.map +1 -0
  296. package/lib/stores/editors/CubeSortDraft.d.ts +49 -0
  297. package/lib/stores/editors/CubeSortDraft.d.ts.map +1 -0
  298. package/lib/stores/editors/CubeSortDraft.js +99 -0
  299. package/lib/stores/editors/CubeSortDraft.js.map +1 -0
  300. package/lib/stores/fixtures/CubeNorthwindModel.d.ts +23 -0
  301. package/lib/stores/fixtures/CubeNorthwindModel.d.ts.map +1 -0
  302. package/lib/stores/fixtures/CubeNorthwindModel.js +338 -0
  303. package/lib/stores/fixtures/CubeNorthwindModel.js.map +1 -0
  304. package/package.json +81 -3
  305. package/src/__lib__/LegendCubeCommand.ts +44 -0
  306. package/src/__lib__/LegendCubeHelpText.ts +58 -0
  307. package/src/__lib__/LegendCubeLabels.ts +171 -0
  308. package/src/__lib__/LegendCubeTesting.ts +33 -0
  309. package/src/__test-utils__/CubeCanvasTestUtils.ts +53 -0
  310. package/src/__test-utils__/CubeEngineTestSupport.ts +172 -0
  311. package/src/__test-utils__/CubeNorthwindTestQueries.ts +165 -0
  312. package/src/__test-utils__/CubeOperationsTestUtils.ts +177 -0
  313. package/src/__test-utils__/CubePageTestUtils.tsx +96 -0
  314. package/src/__test-utils__/CubeTestApplication.ts +82 -0
  315. package/src/__test-utils__/FakeCubeEngine.ts +145 -0
  316. package/src/components/CubeButton.tsx +35 -0
  317. package/src/components/CubeEditor.tsx +239 -0
  318. package/src/components/CubeNodeIcon.tsx +64 -0
  319. package/src/components/canvas/CubeCanvas.tsx +262 -0
  320. package/src/components/canvas/CubeCanvasContext.ts +31 -0
  321. package/src/components/canvas/CubeCanvasContextMenu.tsx +89 -0
  322. package/src/components/canvas/CubeCanvasDnd.ts +82 -0
  323. package/src/components/canvas/CubeCanvasEdge.tsx +57 -0
  324. package/src/components/canvas/CubeCanvasElements.ts +153 -0
  325. package/src/components/canvas/CubeCanvasLayout.ts +88 -0
  326. package/src/components/canvas/CubeCanvasNode.tsx +149 -0
  327. package/src/components/editors/CubeColumnPicker.tsx +138 -0
  328. package/src/components/editors/CubeDistinctEditor.tsx +28 -0
  329. package/src/components/editors/CubeFilterEditor.tsx +309 -0
  330. package/src/components/editors/CubeIntegerField.tsx +51 -0
  331. package/src/components/editors/CubeJoinEditor.tsx +247 -0
  332. package/src/components/editors/CubeNodeEditorPanel.tsx +215 -0
  333. package/src/components/editors/CubeNodeEditorRegistry.ts +81 -0
  334. package/src/components/editors/CubeRenameEditor.tsx +143 -0
  335. package/src/components/editors/CubeRestrictEditor.tsx +103 -0
  336. package/src/components/editors/CubeRowCountEditor.tsx +53 -0
  337. package/src/components/editors/CubeSliceEditor.tsx +69 -0
  338. package/src/components/editors/CubeSortEditor.tsx +206 -0
  339. package/src/components/editors/CubeSourceEditor.tsx +106 -0
  340. package/src/components/editors/CubeValueEditor.tsx +333 -0
  341. package/src/components/grid/CubeGridRegion.tsx +275 -0
  342. package/src/components/grid/CubeGridValues.ts +125 -0
  343. package/src/components/grid/CubeResultGrid.tsx +138 -0
  344. package/src/components/palette/CubePalette.tsx +177 -0
  345. package/src/components/show-pure/CubeShowPureDialog.tsx +101 -0
  346. package/src/components/source-picker/CubeSourcePicker.tsx +304 -0
  347. package/src/components/spec-transfer/CubeSpecTransferDialog.tsx +157 -0
  348. package/src/graph-manager/CubeEngine.ts +169 -0
  349. package/src/graph-manager/CubeModelOutlineHelper.ts +58 -0
  350. package/src/graph-manager/protocol/pure/CubeEngineBuilder.ts +34 -0
  351. package/src/graph-manager/protocol/pure/v1/V1_CubeEngineErrors.ts +109 -0
  352. package/src/graph-manager/protocol/pure/v1/V1_CubeExecutionResultReader.ts +115 -0
  353. package/src/graph-manager/protocol/pure/v1/V1_CubeLambdaSerializer.ts +257 -0
  354. package/src/graph-manager/protocol/pure/v1/V1_CubeModelOutlineBuilder.ts +243 -0
  355. package/src/graph-manager/protocol/pure/v1/V1_CubeRelationTypeAdapter.ts +58 -0
  356. package/src/graph-manager/protocol/pure/v1/V1_LegendCubeEngine.ts +278 -0
  357. package/src/graph-manager/protocol/pure/v1/__test-utils__/V1_CubeEngineTestUtils.ts +127 -0
  358. package/src/index.ts +41 -0
  359. package/src/stores/CubeEditorState.ts +807 -0
  360. package/src/stores/CubeExecutionState.ts +288 -0
  361. package/src/stores/CubeGridQuickActions.ts +129 -0
  362. package/src/stores/CubeHost.ts +32 -0
  363. package/src/stores/CubeNodeEditorState.ts +324 -0
  364. package/src/stores/CubeShowPureState.ts +118 -0
  365. package/src/stores/CubeSourcePickerState.ts +426 -0
  366. package/src/stores/CubeSpecTransferState.ts +198 -0
  367. package/src/stores/LocalModelCatalog.ts +70 -0
  368. package/src/stores/editors/CubeFilterDraft.ts +241 -0
  369. package/src/stores/editors/CubeIntegerText.ts +34 -0
  370. package/src/stores/editors/CubeJoinDraft.ts +224 -0
  371. package/src/stores/editors/CubeNodeDraft.ts +46 -0
  372. package/src/stores/editors/CubeNodeDraftRegistry.ts +83 -0
  373. package/src/stores/editors/CubeRenameDraft.ts +110 -0
  374. package/src/stores/editors/CubeRestrictDraft.ts +83 -0
  375. package/src/stores/editors/CubeRowCountDraft.ts +69 -0
  376. package/src/stores/editors/CubeSliceDraft.ts +87 -0
  377. package/src/stores/editors/CubeSortDraft.ts +135 -0
  378. package/src/stores/fixtures/CubeNorthwindModel.ts +355 -0
  379. package/tsconfig.json +133 -0
@@ -0,0 +1,309 @@
1
+ /**
2
+ * Copyright (c) 2026-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import { clsx, TimesIcon } from '@finos/legend-art';
18
+ import {
19
+ ColumnComparisonFilter,
20
+ CompositeFilter,
21
+ CompositeFilterOperator,
22
+ FILTER_OPERATOR_DESCRIPTIONS,
23
+ type FilterRule,
24
+ getAvailableOperators,
25
+ getFilterValueShape,
26
+ isExactFloatComparison,
27
+ isFilterOperator,
28
+ MESSAGE_FILTER_UNSUPPORTED,
29
+ NEGATIVE_OPERATORS,
30
+ NotFilter,
31
+ type Schema,
32
+ } from '@finos/legend-cube';
33
+ import { guaranteeType } from '@finos/legend-shared';
34
+ import { observer } from 'mobx-react-lite';
35
+ import {
36
+ FILTER_FLOAT_COMPARISON_HINT,
37
+ FILTER_NULL_NOTE,
38
+ } from '../../__lib__/LegendCubeLabels.js';
39
+ import { LEGEND_CUBE_TEST_ID } from '../../__lib__/LegendCubeTesting.js';
40
+ import { CubeFilterDraft } from '../../stores/editors/CubeFilterDraft.js';
41
+ import { CubeButton } from '../CubeButton.js';
42
+ import { CubeColumnPicker } from './CubeColumnPicker.js';
43
+ import type { CubeNodeEditorProps } from './CubeNodeEditorRegistry.js';
44
+ import { CubeValueEditor } from './CubeValueEditor.js';
45
+
46
+ const SMALL_BUTTON =
47
+ 'flex h-6 shrink-0 items-center justify-center rounded-sm px-1 text-sm text-[var(--color-text-secondary)] hover:text-[var(--color-text-primary)] disabled:text-[var(--color-text-disabled)]';
48
+
49
+ interface CubeFilterRuleProps {
50
+ readonly draft: CubeFilterDraft;
51
+ readonly schema: Schema;
52
+ readonly readOnly: boolean;
53
+ /** The Not the rule sits in, if any: the rule's own Not toggle undoes it */
54
+ readonly negation?: NotFilter | undefined;
55
+ }
56
+
57
+ const CubeRemoveRuleButton: React.FC<
58
+ CubeFilterRuleProps & { rule: FilterRule; label: string }
59
+ > = (props) => (
60
+ <button
61
+ className={SMALL_BUTTON}
62
+ aria-label={props.label}
63
+ title={props.label}
64
+ disabled={props.readOnly}
65
+ onClick={() => props.draft.removeRule(props.rule.key)}
66
+ >
67
+ <TimesIcon />
68
+ </button>
69
+ );
70
+
71
+ /**
72
+ * A condition: column, operator and its negation and removal on one line,
73
+ * the value below, with the whole width of the panel
74
+ */
75
+ const CubeFilterCondition = observer(
76
+ (props: CubeFilterRuleProps & { rule: ColumnComparisonFilter }) => {
77
+ const { draft, schema, readOnly, rule, negation } = props;
78
+ const type = schema.type(rule.columnName);
79
+ const operators = type ? getAvailableOperators(type) : [];
80
+ const shape = getFilterValueShape(rule.operator);
81
+ const isNegated =
82
+ negation !== undefined || NEGATIVE_OPERATORS.includes(rule.operator);
83
+ return (
84
+ <li
85
+ className="flex flex-col gap-1 py-1"
86
+ data-testid={LEGEND_CUBE_TEST_ID.FILTER_CONDITION}
87
+ >
88
+ <div className="flex items-center gap-1">
89
+ <div className="min-w-0 flex-1">
90
+ <CubeColumnPicker
91
+ label="Filter column"
92
+ schema={schema}
93
+ value={rule.columnName}
94
+ disabled={readOnly}
95
+ onChange={(name) => draft.setColumn(rule.key, name, schema)}
96
+ />
97
+ </div>
98
+ <select
99
+ aria-label="Filter operator"
100
+ className="h-6 min-w-0 max-w-[45%] shrink rounded-sm border border-[var(--color-border-default)] bg-[var(--color-bg-input)] px-1 text-base"
101
+ value={rule.operator}
102
+ disabled={readOnly || !type}
103
+ onChange={(event) => {
104
+ if (isFilterOperator(event.target.value)) {
105
+ draft.setOperator(rule.key, event.target.value);
106
+ }
107
+ }}
108
+ >
109
+ {!operators.includes(rule.operator) && (
110
+ <option value={rule.operator} disabled={true}>
111
+ {FILTER_OPERATOR_DESCRIPTIONS[rule.operator]}
112
+ </option>
113
+ )}
114
+ {operators.map((operator) => (
115
+ <option key={operator} value={operator}>
116
+ {FILTER_OPERATOR_DESCRIPTIONS[operator]}
117
+ </option>
118
+ ))}
119
+ </select>
120
+ <button
121
+ className={clsx(SMALL_BUTTON, {
122
+ 'text-[var(--color-accent)]': isNegated,
123
+ })}
124
+ aria-label="Negate the condition"
125
+ aria-pressed={isNegated}
126
+ title="Negate the condition, e.g. is and is not"
127
+ disabled={readOnly || !type}
128
+ // a condition in a Not leaves it; otherwise its operator turns
129
+ onClick={() => draft.toggleNegation(negation?.key ?? rule.key)}
130
+ >
131
+ Not
132
+ </button>
133
+ <CubeRemoveRuleButton {...props} label="Remove the condition" />
134
+ </div>
135
+ {type && shape !== 'none' && (
136
+ <div className="flex min-w-0">
137
+ <CubeValueEditor
138
+ label="Filter value"
139
+ type={type}
140
+ shape={shape}
141
+ value={rule.value}
142
+ disabled={readOnly}
143
+ onChange={(value) => draft.setValue(rule.key, value)}
144
+ />
145
+ </div>
146
+ )}
147
+ {type && isExactFloatComparison(rule.operator, type) && (
148
+ <div className="text-sm text-[var(--color-text-secondary)]">
149
+ {FILTER_FLOAT_COMPARISON_HINT}
150
+ </div>
151
+ )}
152
+ </li>
153
+ );
154
+ },
155
+ );
156
+
157
+ /** Any rule of the tree, by kind */
158
+ const CubeFilterRuleEditor = observer(
159
+ (props: CubeFilterRuleProps & { rule: FilterRule }) => {
160
+ const { rule } = props;
161
+ if (rule instanceof ColumnComparisonFilter) {
162
+ return <CubeFilterCondition {...props} rule={rule} />;
163
+ }
164
+ if (rule instanceof CompositeFilter) {
165
+ return (
166
+ <li>
167
+ {/* a group holds rules, so the two render each other */}
168
+ {/* eslint-disable-next-line @typescript-eslint/no-use-before-define */}
169
+ <CubeFilterGroup {...props} group={rule} isTop={false} />
170
+ </li>
171
+ );
172
+ }
173
+ if (rule instanceof NotFilter) {
174
+ return (
175
+ <li className="flex items-start gap-1">
176
+ <button
177
+ className={clsx(SMALL_BUTTON, 'text-[var(--color-accent)]')}
178
+ aria-label="Remove the negation"
179
+ aria-pressed={true}
180
+ title="Remove the negation"
181
+ disabled={props.readOnly}
182
+ onClick={() => props.draft.toggleNegation(rule.key)}
183
+ >
184
+ Not
185
+ </button>
186
+ <ul className="min-w-0 flex-1">
187
+ <CubeFilterRuleEditor {...props} rule={rule.rule} negation={rule} />
188
+ </ul>
189
+ </li>
190
+ );
191
+ }
192
+ // a rule this version can't read stays as it is
193
+ return (
194
+ <li className="flex items-center gap-1 py-1 text-base text-[var(--color-status-warn)]">
195
+ <span className="flex-1">{MESSAGE_FILTER_UNSUPPORTED}</span>
196
+ <CubeRemoveRuleButton {...props} label="Remove the filter" />
197
+ </li>
198
+ );
199
+ },
200
+ );
201
+
202
+ /** An And/Or group: its rules, and buttons to add to it */
203
+ const CubeFilterGroup = observer(
204
+ (props: CubeFilterRuleProps & { group: CompositeFilter; isTop: boolean }) => {
205
+ const { draft, readOnly, group, isTop, negation } = props;
206
+ return (
207
+ <div
208
+ className={clsx('flex flex-col gap-1', {
209
+ 'rounded-sm border border-[var(--color-border-subtle)] p-1': !isTop,
210
+ })}
211
+ >
212
+ <div className="flex items-center gap-1 text-sm">
213
+ <select
214
+ aria-label={
215
+ isTop ? 'Combine the conditions with' : 'Combine the group with'
216
+ }
217
+ className="h-6 rounded-sm border border-[var(--color-border-default)] bg-[var(--color-bg-input)] px-1 text-base"
218
+ value={group.operator}
219
+ disabled={readOnly}
220
+ onChange={(event) =>
221
+ draft.setGroupOperator(
222
+ group.key,
223
+ event.target.value === CompositeFilterOperator.OR
224
+ ? CompositeFilterOperator.OR
225
+ : CompositeFilterOperator.AND,
226
+ )
227
+ }
228
+ >
229
+ <option value={CompositeFilterOperator.AND}>All of (and)</option>
230
+ <option value={CompositeFilterOperator.OR}>Any of (or)</option>
231
+ </select>
232
+ <span className="flex-1" />
233
+ {!isTop && (
234
+ <>
235
+ <button
236
+ className={clsx(SMALL_BUTTON, {
237
+ 'text-[var(--color-accent)]': negation !== undefined,
238
+ })}
239
+ aria-label="Negate the group"
240
+ aria-pressed={negation !== undefined}
241
+ title="Keep the rows the group doesn't match"
242
+ disabled={readOnly}
243
+ // a group in a Not leaves it
244
+ onClick={() => draft.toggleNegation(negation?.key ?? group.key)}
245
+ >
246
+ Not
247
+ </button>
248
+ <CubeRemoveRuleButton
249
+ {...props}
250
+ rule={group}
251
+ label="Remove the group"
252
+ />
253
+ </>
254
+ )}
255
+ </div>
256
+ <ul className="flex flex-col pl-2">
257
+ {group.rules.map((rule) => (
258
+ <CubeFilterRuleEditor
259
+ key={rule.key}
260
+ {...props}
261
+ rule={rule}
262
+ // the group's Not is not its rules'
263
+ negation={undefined}
264
+ />
265
+ ))}
266
+ </ul>
267
+ <div className="flex gap-1">
268
+ <CubeButton
269
+ disabled={readOnly}
270
+ onClick={() => draft.addCondition(group.key)}
271
+ >
272
+ {isTop ? 'Add condition' : 'Add condition to the group'}
273
+ </CubeButton>
274
+ <CubeButton
275
+ disabled={readOnly}
276
+ onClick={() => draft.addGroup(group.key)}
277
+ >
278
+ {isTop ? 'Add group' : 'Add group to the group'}
279
+ </CubeButton>
280
+ </div>
281
+ </div>
282
+ );
283
+ },
284
+ );
285
+
286
+ /**
287
+ * The Filter editor (spec §8.5): conditions of a column, an operator and a
288
+ * value, in And/Or groups, each of which can be negated. Operators follow
289
+ * the column's type; values are read as its type, and text that isn't one is
290
+ * kept, marked, to be fixed. Blank conditions are not stored.
291
+ */
292
+ export const CubeFilterEditor = observer((props: CubeNodeEditorProps) => {
293
+ const draft = guaranteeType(props.draft, CubeFilterDraft);
294
+ const [schema] = props.inputSchemas as [Schema];
295
+ return (
296
+ <div className="flex flex-col gap-2">
297
+ <CubeFilterGroup
298
+ draft={draft}
299
+ schema={schema}
300
+ readOnly={props.readOnly}
301
+ group={draft.tree}
302
+ isTop={true}
303
+ />
304
+ <div className="text-sm text-[var(--color-text-secondary)]">
305
+ {FILTER_NULL_NOTE}
306
+ </div>
307
+ </div>
308
+ );
309
+ });
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Copyright (c) 2026-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import { clsx } from '@finos/legend-art';
18
+
19
+ /**
20
+ * A field for a whole number, such as a size or a row index. It shows the
21
+ * text as typed and reports every keystroke, so the panel checks the edited
22
+ * node as the user types. Enter and Escape do nothing special: Apply is the
23
+ * panel's, and Ctrl+Z is the field's own undo.
24
+ */
25
+ export const CubeIntegerField: React.FC<{
26
+ label: string;
27
+ text: string;
28
+ invalid: boolean;
29
+ disabled: boolean;
30
+ onChange: (text: string) => void;
31
+ }> = (props) => {
32
+ const { label, text, invalid, disabled, onChange } = props;
33
+ return (
34
+ <input
35
+ aria-label={label}
36
+ aria-invalid={invalid}
37
+ className={clsx(
38
+ 'h-6 w-24 rounded-sm border bg-[var(--color-bg-input)] px-1 text-base',
39
+ invalid
40
+ ? 'border-[var(--color-status-error)] text-[var(--color-status-error)]'
41
+ : 'border-[var(--color-border-default)]',
42
+ )}
43
+ type="text"
44
+ inputMode="numeric"
45
+ spellCheck={false}
46
+ value={text}
47
+ disabled={disabled}
48
+ onChange={(event) => onChange(event.target.value)}
49
+ />
50
+ );
51
+ };
@@ -0,0 +1,247 @@
1
+ /**
2
+ * Copyright (c) 2026-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import { TimesIcon } from '@finos/legend-art';
18
+ import {
19
+ areCompatibleTypes,
20
+ getDuplicateJoinColumns,
21
+ isJoinType,
22
+ JOIN_TYPE_LABELS,
23
+ JOIN_TYPES,
24
+ planJoinDuplicateFix,
25
+ type Schema,
26
+ } from '@finos/legend-cube';
27
+ import { guaranteeType, noop } from '@finos/legend-shared';
28
+ import { flowResult } from 'mobx';
29
+ import { observer } from 'mobx-react-lite';
30
+ import { useEffect } from 'react';
31
+ import {
32
+ CUBE_TABLE_FLAG_LABELS,
33
+ READ_ONLY_CUBE_TITLE,
34
+ } from '../../__lib__/LegendCubeLabels.js';
35
+ import { CubeTableFlag } from '../../graph-manager/CubeEngine.js';
36
+ import {
37
+ type CubeJoinKeyPair,
38
+ CubeJoinDraft,
39
+ isUntypedColumn,
40
+ } from '../../stores/editors/CubeJoinDraft.js';
41
+ import { CubeButton } from '../CubeButton.js';
42
+ import { CubeColumnPicker } from './CubeColumnPicker.js';
43
+ import type { CubeNodeEditorProps } from './CubeNodeEditorRegistry.js';
44
+
45
+ const TYPE_UNKNOWN = CUBE_TABLE_FLAG_LABELS[CubeTableFlag.TYPE_UNKNOWN];
46
+
47
+ const CubeJoinKeyRow = observer(
48
+ (props: {
49
+ editorProps: CubeNodeEditorProps;
50
+ draft: CubeJoinDraft;
51
+ pair: CubeJoinKeyPair;
52
+ index: number;
53
+ leftSchema: Schema;
54
+ rightSchema: Schema;
55
+ }) => {
56
+ const { editorProps, draft, pair, index, leftSchema, rightSchema } = props;
57
+ const { editorState, readOnly } = editorProps;
58
+ const { query } = editorState.document;
59
+ const { analysis, modelOutline } = editorState;
60
+ const [leftId, rightId] = query.getInputIds(draft.original.id);
61
+ const leftType = leftSchema.type(pair.left);
62
+ const rightType = rightSchema.type(pair.right);
63
+ const isIncompatible =
64
+ leftType !== undefined &&
65
+ rightType !== undefined &&
66
+ !areCompatibleTypes(leftType, rightType);
67
+ const isUntyped =
68
+ (leftId !== undefined &&
69
+ Boolean(pair.left) &&
70
+ isUntypedColumn(modelOutline, query, analysis, leftId, pair.left)) ||
71
+ (rightId !== undefined &&
72
+ Boolean(pair.right) &&
73
+ isUntypedColumn(modelOutline, query, analysis, rightId, pair.right));
74
+ const position = index + 1;
75
+ return (
76
+ <li className="flex flex-col gap-1 border-b border-[var(--color-border-subtle)] py-1">
77
+ <div className="grid grid-cols-[1fr_auto_1fr_auto] items-center gap-1">
78
+ <CubeColumnPicker
79
+ label={`Left join column ${position}`}
80
+ schema={leftSchema}
81
+ value={pair.left}
82
+ invalid={isIncompatible}
83
+ disabled={readOnly}
84
+ onChange={(name) => draft.setLeftColumn(pair.key, name)}
85
+ />
86
+ <span className="text-[var(--color-text-secondary)]">=</span>
87
+ <CubeColumnPicker
88
+ label={`Right join column ${position}`}
89
+ schema={rightSchema}
90
+ value={pair.right}
91
+ invalid={isIncompatible}
92
+ disabled={readOnly}
93
+ onChange={(name) => draft.setRightColumn(pair.key, name)}
94
+ />
95
+ <button
96
+ className="flex h-6 w-6 items-center justify-center text-[var(--color-text-secondary)] hover:text-[var(--color-text-primary)] disabled:text-[var(--color-text-disabled)]"
97
+ aria-label={`Remove join columns ${position}`}
98
+ title="Remove these join columns"
99
+ disabled={readOnly}
100
+ onClick={() => draft.removePair(pair.key)}
101
+ >
102
+ <TimesIcon />
103
+ </button>
104
+ </div>
105
+ {isIncompatible && (
106
+ <div className="text-sm text-[var(--color-status-error)]">
107
+ {`${leftType.displayName} and ${rightType.displayName} can't be compared`}
108
+ </div>
109
+ )}
110
+ {isUntyped && (
111
+ <div
112
+ className="text-sm text-[var(--color-status-warn)]"
113
+ title={TYPE_UNKNOWN.description}
114
+ >
115
+ {`${TYPE_UNKNOWN.label}: the column's real type is not known to Cube, so the engine may not match its values`}
116
+ </div>
117
+ )}
118
+ </li>
119
+ );
120
+ },
121
+ );
122
+
123
+ /**
124
+ * The Join editor (spec §17.6): the join type, pairs of key columns, a left
125
+ * one from the Left input and a right one from the Right input, and Swap
126
+ * Inputs. A pair whose types can't be compared is marked; one on a column
127
+ * Cube can't type is warned about, not blocked.
128
+ */
129
+ export const CubeJoinEditor = observer((props: CubeNodeEditorProps) => {
130
+ const { editorState, inputSchemas, readOnly } = props;
131
+ const draft = guaranteeType(props.draft, CubeJoinDraft);
132
+ const [leftSchema, rightSchema] = inputSchemas as [Schema, Schema];
133
+ const model = editorState.document.context?.model;
134
+ useEffect(() => {
135
+ flowResult(editorState.loadModelOutline()).catch(noop());
136
+ }, [editorState, model]);
137
+ const edited = draft.build();
138
+ const duplicates = getDuplicateJoinColumns(
139
+ leftSchema,
140
+ rightSchema,
141
+ edited.leftColumns,
142
+ edited.rightColumns,
143
+ );
144
+ // the names the autofix would give, to show beside each shared column
145
+ const fix = duplicates.length
146
+ ? planJoinDuplicateFix(edited, leftSchema, rightSchema)
147
+ : undefined;
148
+ const canAddPair =
149
+ !readOnly &&
150
+ draft.pairs.length <
151
+ Math.min(leftSchema.columns.length, rightSchema.columns.length);
152
+ return (
153
+ <div className="flex flex-col gap-2 text-base">
154
+ <div className="flex items-center gap-2">
155
+ <label className="flex items-center gap-2">
156
+ Join type
157
+ <select
158
+ className="h-6 rounded-sm border border-[var(--color-border-default)] bg-[var(--color-bg-input)] px-1 text-base"
159
+ value={draft.joinType}
160
+ disabled={readOnly}
161
+ onChange={(event) => {
162
+ if (isJoinType(event.target.value)) {
163
+ draft.setJoinType(event.target.value);
164
+ }
165
+ }}
166
+ >
167
+ {JOIN_TYPES.map((joinType) => (
168
+ <option key={joinType} value={joinType}>
169
+ {JOIN_TYPE_LABELS[joinType]}
170
+ </option>
171
+ ))}
172
+ </select>
173
+ </label>
174
+ <span className="flex-1" />
175
+ <CubeButton
176
+ title="Swap the Left and Right inputs; the join columns follow them. Applies your changes too."
177
+ disabled={!editorState.nodeEditor.canSwapInputs}
178
+ onClick={() => editorState.nodeEditor.swapInputs()}
179
+ >
180
+ Swap Inputs
181
+ </CubeButton>
182
+ </div>
183
+ <div className="grid grid-cols-[1fr_auto_1fr_auto] gap-1 text-sm text-[var(--color-text-secondary)]">
184
+ <span>Left</span>
185
+ <span />
186
+ <span>Right</span>
187
+ <span />
188
+ </div>
189
+ <ul aria-label="Join columns">
190
+ {draft.pairs.map((pair, index) => (
191
+ <CubeJoinKeyRow
192
+ key={pair.key}
193
+ editorProps={props}
194
+ draft={draft}
195
+ pair={pair}
196
+ index={index}
197
+ leftSchema={leftSchema}
198
+ rightSchema={rightSchema}
199
+ />
200
+ ))}
201
+ </ul>
202
+ <div>
203
+ <CubeButton
204
+ title={
205
+ canAddPair
206
+ ? 'Add a pair of join columns'
207
+ : 'Every column of an input is already a join column'
208
+ }
209
+ disabled={!canAddPair}
210
+ onClick={() => draft.addPair()}
211
+ >
212
+ Add join columns
213
+ </CubeButton>
214
+ </div>
215
+ {duplicates.length > 0 && (
216
+ <div className="text-sm text-[var(--color-status-warn)]">
217
+ <div>
218
+ In both inputs and not joined on, so the output can&apos;t keep
219
+ both:
220
+ </div>
221
+ <ul aria-label="Columns in both inputs">
222
+ {duplicates.map((name, index) => (
223
+ <li key={name} className="font-mono">
224
+ {fix
225
+ ? `${name} → ${fix.left[index]?.to} (Left), ${fix.right[index]?.to} (Right)`
226
+ : name}
227
+ </li>
228
+ ))}
229
+ </ul>
230
+ <div className="mt-1">
231
+ <CubeButton
232
+ title={
233
+ readOnly
234
+ ? READ_ONLY_CUBE_TITLE
235
+ : 'Add a Rename before each input that gives these columns new names. Applies your changes too, as one step to undo.'
236
+ }
237
+ disabled={!editorState.nodeEditor.canRenameDuplicateColumns}
238
+ onClick={() => editorState.nodeEditor.renameDuplicateColumns()}
239
+ >
240
+ Rename them
241
+ </CubeButton>
242
+ </div>
243
+ </div>
244
+ )}
245
+ </div>
246
+ );
247
+ });