@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.
- package/LICENSE +201 -0
- package/README.md +64 -2
- package/docs/adding-an-operation.md +92 -0
- package/docs/hosting.md +79 -0
- package/docs/testing.md +83 -0
- package/lib/__lib__/LegendCubeCommand.d.ts +26 -0
- package/lib/__lib__/LegendCubeCommand.d.ts.map +1 -0
- package/lib/__lib__/LegendCubeCommand.js +40 -0
- package/lib/__lib__/LegendCubeCommand.js.map +1 -0
- package/lib/__lib__/LegendCubeHelpText.d.ts +19 -0
- package/lib/__lib__/LegendCubeHelpText.d.ts.map +1 -0
- package/lib/__lib__/LegendCubeHelpText.js +35 -0
- package/lib/__lib__/LegendCubeHelpText.js.map +1 -0
- package/lib/__lib__/LegendCubeLabels.d.ts +87 -0
- package/lib/__lib__/LegendCubeLabels.d.ts.map +1 -0
- package/lib/__lib__/LegendCubeLabels.js +128 -0
- package/lib/__lib__/LegendCubeLabels.js.map +1 -0
- package/lib/__lib__/LegendCubeTesting.d.ts +33 -0
- package/lib/__lib__/LegendCubeTesting.d.ts.map +1 -0
- package/lib/__lib__/LegendCubeTesting.js +34 -0
- package/lib/__lib__/LegendCubeTesting.js.map +1 -0
- package/lib/__test-utils__/CubeCanvasTestUtils.d.ts +24 -0
- package/lib/__test-utils__/CubeCanvasTestUtils.d.ts.map +1 -0
- package/lib/__test-utils__/CubeCanvasTestUtils.js +37 -0
- package/lib/__test-utils__/CubeCanvasTestUtils.js.map +1 -0
- package/lib/__test-utils__/CubeEngineTestSupport.d.ts +47 -0
- package/lib/__test-utils__/CubeEngineTestSupport.d.ts.map +1 -0
- package/lib/__test-utils__/CubeEngineTestSupport.js +106 -0
- package/lib/__test-utils__/CubeEngineTestSupport.js.map +1 -0
- package/lib/__test-utils__/CubeNorthwindTestQueries.d.ts +31 -0
- package/lib/__test-utils__/CubeNorthwindTestQueries.d.ts.map +1 -0
- package/lib/__test-utils__/CubeNorthwindTestQueries.js +102 -0
- package/lib/__test-utils__/CubeNorthwindTestQueries.js.map +1 -0
- package/lib/__test-utils__/CubeOperationsTestUtils.d.ts +42 -0
- package/lib/__test-utils__/CubeOperationsTestUtils.d.ts.map +1 -0
- package/lib/__test-utils__/CubeOperationsTestUtils.js +92 -0
- package/lib/__test-utils__/CubeOperationsTestUtils.js.map +1 -0
- package/lib/__test-utils__/CubePageTestUtils.d.ts +33 -0
- package/lib/__test-utils__/CubePageTestUtils.d.ts.map +1 -0
- package/lib/__test-utils__/CubePageTestUtils.js +68 -0
- package/lib/__test-utils__/CubePageTestUtils.js.map +1 -0
- package/lib/__test-utils__/CubeTestApplication.d.ts +30 -0
- package/lib/__test-utils__/CubeTestApplication.d.ts.map +1 -0
- package/lib/__test-utils__/CubeTestApplication.js +57 -0
- package/lib/__test-utils__/CubeTestApplication.js.map +1 -0
- package/lib/__test-utils__/FakeCubeEngine.d.ts +41 -0
- package/lib/__test-utils__/FakeCubeEngine.d.ts.map +1 -0
- package/lib/__test-utils__/FakeCubeEngine.js +91 -0
- package/lib/__test-utils__/FakeCubeEngine.js.map +1 -0
- package/lib/components/CubeButton.d.ts +20 -0
- package/lib/components/CubeButton.d.ts.map +1 -0
- package/lib/components/CubeButton.js +24 -0
- package/lib/components/CubeButton.js.map +1 -0
- package/lib/components/CubeEditor.d.ts +31 -0
- package/lib/components/CubeEditor.d.ts.map +1 -0
- package/lib/components/CubeEditor.js +90 -0
- package/lib/components/CubeEditor.js.map +1 -0
- package/lib/components/CubeNodeIcon.d.ts +23 -0
- package/lib/components/CubeNodeIcon.d.ts.map +1 -0
- package/lib/components/CubeNodeIcon.js +42 -0
- package/lib/components/CubeNodeIcon.js.map +1 -0
- package/lib/components/canvas/CubeCanvas.d.ts +37 -0
- package/lib/components/canvas/CubeCanvas.d.ts.map +1 -0
- package/lib/components/canvas/CubeCanvas.js +137 -0
- package/lib/components/canvas/CubeCanvas.js.map +1 -0
- package/lib/components/canvas/CubeCanvasContext.d.ts +19 -0
- package/lib/components/canvas/CubeCanvasContext.d.ts.map +1 -0
- package/lib/components/canvas/CubeCanvasContext.js +22 -0
- package/lib/components/canvas/CubeCanvasContext.js.map +1 -0
- package/lib/components/canvas/CubeCanvasContextMenu.d.ts +28 -0
- package/lib/components/canvas/CubeCanvasContextMenu.d.ts.map +1 -0
- package/lib/components/canvas/CubeCanvasContextMenu.js +35 -0
- package/lib/components/canvas/CubeCanvasContextMenu.js.map +1 -0
- package/lib/components/canvas/CubeCanvasDnd.d.ts +43 -0
- package/lib/components/canvas/CubeCanvasDnd.d.ts.map +1 -0
- package/lib/components/canvas/CubeCanvasDnd.js +51 -0
- package/lib/components/canvas/CubeCanvasDnd.js.map +1 -0
- package/lib/components/canvas/CubeCanvasEdge.d.ts +24 -0
- package/lib/components/canvas/CubeCanvasEdge.d.ts.map +1 -0
- package/lib/components/canvas/CubeCanvasEdge.js +33 -0
- package/lib/components/canvas/CubeCanvasEdge.js.map +1 -0
- package/lib/components/canvas/CubeCanvasElements.d.ts +66 -0
- package/lib/components/canvas/CubeCanvasElements.d.ts.map +1 -0
- package/lib/components/canvas/CubeCanvasElements.js +97 -0
- package/lib/components/canvas/CubeCanvasElements.js.map +1 -0
- package/lib/components/canvas/CubeCanvasLayout.d.ts +32 -0
- package/lib/components/canvas/CubeCanvasLayout.d.ts.map +1 -0
- package/lib/components/canvas/CubeCanvasLayout.js +63 -0
- package/lib/components/canvas/CubeCanvasLayout.js.map +1 -0
- package/lib/components/canvas/CubeCanvasNode.d.ts +29 -0
- package/lib/components/canvas/CubeCanvasNode.d.ts.map +1 -0
- package/lib/components/canvas/CubeCanvasNode.js +75 -0
- package/lib/components/canvas/CubeCanvasNode.js.map +1 -0
- package/lib/components/editors/CubeColumnPicker.d.ts +47 -0
- package/lib/components/editors/CubeColumnPicker.d.ts.map +1 -0
- package/lib/components/editors/CubeColumnPicker.js +56 -0
- package/lib/components/editors/CubeColumnPicker.js.map +1 -0
- package/lib/components/editors/CubeDistinctEditor.d.ts +23 -0
- package/lib/components/editors/CubeDistinctEditor.d.ts.map +1 -0
- package/lib/components/editors/CubeDistinctEditor.js +24 -0
- package/lib/components/editors/CubeDistinctEditor.js.map +1 -0
- package/lib/components/editors/CubeFilterEditor.d.ts +26 -0
- package/lib/components/editors/CubeFilterEditor.d.ts.map +1 -0
- package/lib/components/editors/CubeFilterEditor.js +90 -0
- package/lib/components/editors/CubeFilterEditor.js.map +1 -0
- package/lib/components/editors/CubeIntegerField.d.ts +29 -0
- package/lib/components/editors/CubeIntegerField.d.ts.map +1 -0
- package/lib/components/editors/CubeIntegerField.js +30 -0
- package/lib/components/editors/CubeIntegerField.js.map +1 -0
- package/lib/components/editors/CubeJoinEditor.d.ts +26 -0
- package/lib/components/editors/CubeJoinEditor.d.ts.map +1 -0
- package/lib/components/editors/CubeJoinEditor.js +84 -0
- package/lib/components/editors/CubeJoinEditor.js.map +1 -0
- package/lib/components/editors/CubeNodeEditorPanel.d.ts +29 -0
- package/lib/components/editors/CubeNodeEditorPanel.d.ts.map +1 -0
- package/lib/components/editors/CubeNodeEditorPanel.js +72 -0
- package/lib/components/editors/CubeNodeEditorPanel.js.map +1 -0
- package/lib/components/editors/CubeNodeEditorRegistry.d.ts +44 -0
- package/lib/components/editors/CubeNodeEditorRegistry.d.ts.map +1 -0
- package/lib/components/editors/CubeNodeEditorRegistry.js +43 -0
- package/lib/components/editors/CubeNodeEditorRegistry.js.map +1 -0
- package/lib/components/editors/CubeRenameEditor.d.ts +26 -0
- package/lib/components/editors/CubeRenameEditor.d.ts.map +1 -0
- package/lib/components/editors/CubeRenameEditor.js +58 -0
- package/lib/components/editors/CubeRenameEditor.js.map +1 -0
- package/lib/components/editors/CubeRestrictEditor.d.ts +26 -0
- package/lib/components/editors/CubeRestrictEditor.d.ts.map +1 -0
- package/lib/components/editors/CubeRestrictEditor.js +23 -0
- package/lib/components/editors/CubeRestrictEditor.js.map +1 -0
- package/lib/components/editors/CubeRowCountEditor.d.ts +25 -0
- package/lib/components/editors/CubeRowCountEditor.d.ts.map +1 -0
- package/lib/components/editors/CubeRowCountEditor.js +38 -0
- package/lib/components/editors/CubeRowCountEditor.js.map +1 -0
- package/lib/components/editors/CubeSliceEditor.d.ts +25 -0
- package/lib/components/editors/CubeSliceEditor.d.ts.map +1 -0
- package/lib/components/editors/CubeSliceEditor.js +40 -0
- package/lib/components/editors/CubeSliceEditor.js.map +1 -0
- package/lib/components/editors/CubeSortEditor.d.ts +27 -0
- package/lib/components/editors/CubeSortEditor.d.ts.map +1 -0
- package/lib/components/editors/CubeSortEditor.js +72 -0
- package/lib/components/editors/CubeSortEditor.js.map +1 -0
- package/lib/components/editors/CubeSourceEditor.d.ts +25 -0
- package/lib/components/editors/CubeSourceEditor.d.ts.map +1 -0
- package/lib/components/editors/CubeSourceEditor.js +41 -0
- package/lib/components/editors/CubeSourceEditor.js.map +1 -0
- package/lib/components/editors/CubeValueEditor.d.ts +40 -0
- package/lib/components/editors/CubeValueEditor.d.ts.map +1 -0
- package/lib/components/editors/CubeValueEditor.js +178 -0
- package/lib/components/editors/CubeValueEditor.js.map +1 -0
- package/lib/components/grid/CubeGridRegion.d.ts +23 -0
- package/lib/components/grid/CubeGridRegion.d.ts.map +1 -0
- package/lib/components/grid/CubeGridRegion.js +94 -0
- package/lib/components/grid/CubeGridRegion.js.map +1 -0
- package/lib/components/grid/CubeGridValues.d.ts +25 -0
- package/lib/components/grid/CubeGridValues.d.ts.map +1 -0
- package/lib/components/grid/CubeGridValues.js +95 -0
- package/lib/components/grid/CubeGridValues.js.map +1 -0
- package/lib/components/grid/CubeResultGrid.d.ts +39 -0
- package/lib/components/grid/CubeResultGrid.d.ts.map +1 -0
- package/lib/components/grid/CubeResultGrid.js +86 -0
- package/lib/components/grid/CubeResultGrid.js.map +1 -0
- package/lib/components/palette/CubePalette.d.ts +29 -0
- package/lib/components/palette/CubePalette.d.ts.map +1 -0
- package/lib/components/palette/CubePalette.js +73 -0
- package/lib/components/palette/CubePalette.js.map +1 -0
- package/lib/components/show-pure/CubeShowPureDialog.d.ts +23 -0
- package/lib/components/show-pure/CubeShowPureDialog.d.ts.map +1 -0
- package/lib/components/show-pure/CubeShowPureDialog.js +37 -0
- package/lib/components/show-pure/CubeShowPureDialog.js.map +1 -0
- package/lib/components/source-picker/CubeSourcePicker.d.ts +22 -0
- package/lib/components/source-picker/CubeSourcePicker.d.ts.map +1 -0
- package/lib/components/source-picker/CubeSourcePicker.js +89 -0
- package/lib/components/source-picker/CubeSourcePicker.js.map +1 -0
- package/lib/components/spec-transfer/CubeSpecTransferDialog.d.ts +26 -0
- package/lib/components/spec-transfer/CubeSpecTransferDialog.d.ts.map +1 -0
- package/lib/components/spec-transfer/CubeSpecTransferDialog.js +45 -0
- package/lib/components/spec-transfer/CubeSpecTransferDialog.js.map +1 -0
- package/lib/graph-manager/CubeEngine.d.ts +128 -0
- package/lib/graph-manager/CubeEngine.d.ts.map +1 -0
- package/lib/graph-manager/CubeEngine.js +61 -0
- package/lib/graph-manager/CubeEngine.js.map +1 -0
- package/lib/graph-manager/CubeModelOutlineHelper.d.ts +33 -0
- package/lib/graph-manager/CubeModelOutlineHelper.d.ts.map +1 -0
- package/lib/graph-manager/CubeModelOutlineHelper.js +45 -0
- package/lib/graph-manager/CubeModelOutlineHelper.js.map +1 -0
- package/lib/graph-manager/protocol/pure/CubeEngineBuilder.d.ts +26 -0
- package/lib/graph-manager/protocol/pure/CubeEngineBuilder.d.ts.map +1 -0
- package/lib/graph-manager/protocol/pure/CubeEngineBuilder.js +22 -0
- package/lib/graph-manager/protocol/pure/CubeEngineBuilder.js.map +1 -0
- package/lib/graph-manager/protocol/pure/v1/V1_CubeEngineErrors.d.ts +27 -0
- package/lib/graph-manager/protocol/pure/v1/V1_CubeEngineErrors.d.ts.map +1 -0
- package/lib/graph-manager/protocol/pure/v1/V1_CubeEngineErrors.js +76 -0
- package/lib/graph-manager/protocol/pure/v1/V1_CubeEngineErrors.js.map +1 -0
- package/lib/graph-manager/protocol/pure/v1/V1_CubeExecutionResultReader.d.ts +27 -0
- package/lib/graph-manager/protocol/pure/v1/V1_CubeExecutionResultReader.d.ts.map +1 -0
- package/lib/graph-manager/protocol/pure/v1/V1_CubeExecutionResultReader.js +82 -0
- package/lib/graph-manager/protocol/pure/v1/V1_CubeExecutionResultReader.js.map +1 -0
- package/lib/graph-manager/protocol/pure/v1/V1_CubeLambdaSerializer.d.ts +32 -0
- package/lib/graph-manager/protocol/pure/v1/V1_CubeLambdaSerializer.d.ts.map +1 -0
- package/lib/graph-manager/protocol/pure/v1/V1_CubeLambdaSerializer.js +195 -0
- package/lib/graph-manager/protocol/pure/v1/V1_CubeLambdaSerializer.js.map +1 -0
- package/lib/graph-manager/protocol/pure/v1/V1_CubeModelOutlineBuilder.d.ts +20 -0
- package/lib/graph-manager/protocol/pure/v1/V1_CubeModelOutlineBuilder.d.ts.map +1 -0
- package/lib/graph-manager/protocol/pure/v1/V1_CubeModelOutlineBuilder.js +174 -0
- package/lib/graph-manager/protocol/pure/v1/V1_CubeModelOutlineBuilder.js.map +1 -0
- package/lib/graph-manager/protocol/pure/v1/V1_CubeRelationTypeAdapter.d.ts +24 -0
- package/lib/graph-manager/protocol/pure/v1/V1_CubeRelationTypeAdapter.d.ts.map +1 -0
- package/lib/graph-manager/protocol/pure/v1/V1_CubeRelationTypeAdapter.js +43 -0
- package/lib/graph-manager/protocol/pure/v1/V1_CubeRelationTypeAdapter.js.map +1 -0
- package/lib/graph-manager/protocol/pure/v1/V1_LegendCubeEngine.d.ts +45 -0
- package/lib/graph-manager/protocol/pure/v1/V1_LegendCubeEngine.d.ts.map +1 -0
- package/lib/graph-manager/protocol/pure/v1/V1_LegendCubeEngine.js +171 -0
- package/lib/graph-manager/protocol/pure/v1/V1_LegendCubeEngine.js.map +1 -0
- package/lib/graph-manager/protocol/pure/v1/__test-utils__/V1_CubeEngineTestUtils.d.ts +22 -0
- package/lib/graph-manager/protocol/pure/v1/__test-utils__/V1_CubeEngineTestUtils.d.ts.map +1 -0
- package/lib/graph-manager/protocol/pure/v1/__test-utils__/V1_CubeEngineTestUtils.js +79 -0
- package/lib/graph-manager/protocol/pure/v1/__test-utils__/V1_CubeEngineTestUtils.js.map +1 -0
- package/lib/index.css +17 -0
- package/lib/index.css.map +1 -0
- package/lib/index.d.ts +25 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +24 -0
- package/lib/index.js.map +1 -0
- package/lib/stores/CubeEditorState.d.ts +236 -0
- package/lib/stores/CubeEditorState.d.ts.map +1 -0
- package/lib/stores/CubeEditorState.js +632 -0
- package/lib/stores/CubeEditorState.js.map +1 -0
- package/lib/stores/CubeExecutionState.d.ts +67 -0
- package/lib/stores/CubeExecutionState.d.ts.map +1 -0
- package/lib/stores/CubeExecutionState.js +212 -0
- package/lib/stores/CubeExecutionState.js.map +1 -0
- package/lib/stores/CubeGridQuickActions.d.ts +40 -0
- package/lib/stores/CubeGridQuickActions.d.ts.map +1 -0
- package/lib/stores/CubeGridQuickActions.js +86 -0
- package/lib/stores/CubeGridQuickActions.js.map +1 -0
- package/lib/stores/CubeHost.d.ts +31 -0
- package/lib/stores/CubeHost.d.ts.map +1 -0
- package/lib/stores/CubeHost.js +17 -0
- package/lib/stores/CubeHost.js.map +1 -0
- package/lib/stores/CubeNodeEditorState.d.ts +103 -0
- package/lib/stores/CubeNodeEditorState.d.ts.map +1 -0
- package/lib/stores/CubeNodeEditorState.js +262 -0
- package/lib/stores/CubeNodeEditorState.js.map +1 -0
- package/lib/stores/CubeShowPureState.d.ts +41 -0
- package/lib/stores/CubeShowPureState.d.ts.map +1 -0
- package/lib/stores/CubeShowPureState.js +100 -0
- package/lib/stores/CubeShowPureState.js.map +1 -0
- package/lib/stores/CubeSourcePickerState.d.ts +98 -0
- package/lib/stores/CubeSourcePickerState.d.ts.map +1 -0
- package/lib/stores/CubeSourcePickerState.js +334 -0
- package/lib/stores/CubeSourcePickerState.js.map +1 -0
- package/lib/stores/CubeSpecTransferState.d.ts +60 -0
- package/lib/stores/CubeSpecTransferState.d.ts.map +1 -0
- package/lib/stores/CubeSpecTransferState.js +167 -0
- package/lib/stores/CubeSpecTransferState.js.map +1 -0
- package/lib/stores/LocalModelCatalog.d.ts +37 -0
- package/lib/stores/LocalModelCatalog.d.ts.map +1 -0
- package/lib/stores/LocalModelCatalog.js +49 -0
- package/lib/stores/LocalModelCatalog.js.map +1 -0
- package/lib/stores/editors/CubeFilterDraft.d.ts +61 -0
- package/lib/stores/editors/CubeFilterDraft.d.ts.map +1 -0
- package/lib/stores/editors/CubeFilterDraft.js +186 -0
- package/lib/stores/editors/CubeFilterDraft.js.map +1 -0
- package/lib/stores/editors/CubeIntegerText.d.ts +24 -0
- package/lib/stores/editors/CubeIntegerText.d.ts.map +1 -0
- package/lib/stores/editors/CubeIntegerText.js +33 -0
- package/lib/stores/editors/CubeIntegerText.js.map +1 -0
- package/lib/stores/editors/CubeJoinDraft.d.ts +71 -0
- package/lib/stores/editors/CubeJoinDraft.d.ts.map +1 -0
- package/lib/stores/editors/CubeJoinDraft.js +145 -0
- package/lib/stores/editors/CubeJoinDraft.js.map +1 -0
- package/lib/stores/editors/CubeNodeDraft.d.ts +38 -0
- package/lib/stores/editors/CubeNodeDraft.d.ts.map +1 -0
- package/lib/stores/editors/CubeNodeDraft.js +35 -0
- package/lib/stores/editors/CubeNodeDraft.js.map +1 -0
- package/lib/stores/editors/CubeNodeDraftRegistry.d.ts +35 -0
- package/lib/stores/editors/CubeNodeDraftRegistry.d.ts.map +1 -0
- package/lib/stores/editors/CubeNodeDraftRegistry.js +55 -0
- package/lib/stores/editors/CubeNodeDraftRegistry.js.map +1 -0
- package/lib/stores/editors/CubeRenameDraft.d.ts +44 -0
- package/lib/stores/editors/CubeRenameDraft.d.ts.map +1 -0
- package/lib/stores/editors/CubeRenameDraft.js +79 -0
- package/lib/stores/editors/CubeRenameDraft.js.map +1 -0
- package/lib/stores/editors/CubeRestrictDraft.d.ts +37 -0
- package/lib/stores/editors/CubeRestrictDraft.d.ts.map +1 -0
- package/lib/stores/editors/CubeRestrictDraft.js +73 -0
- package/lib/stores/editors/CubeRestrictDraft.js.map +1 -0
- package/lib/stores/editors/CubeRowCountDraft.d.ts +42 -0
- package/lib/stores/editors/CubeRowCountDraft.d.ts.map +1 -0
- package/lib/stores/editors/CubeRowCountDraft.js +55 -0
- package/lib/stores/editors/CubeRowCountDraft.js.map +1 -0
- package/lib/stores/editors/CubeSliceDraft.d.ts +42 -0
- package/lib/stores/editors/CubeSliceDraft.d.ts.map +1 -0
- package/lib/stores/editors/CubeSliceDraft.js +72 -0
- package/lib/stores/editors/CubeSliceDraft.js.map +1 -0
- package/lib/stores/editors/CubeSortDraft.d.ts +49 -0
- package/lib/stores/editors/CubeSortDraft.d.ts.map +1 -0
- package/lib/stores/editors/CubeSortDraft.js +99 -0
- package/lib/stores/editors/CubeSortDraft.js.map +1 -0
- package/lib/stores/fixtures/CubeNorthwindModel.d.ts +23 -0
- package/lib/stores/fixtures/CubeNorthwindModel.d.ts.map +1 -0
- package/lib/stores/fixtures/CubeNorthwindModel.js +338 -0
- package/lib/stores/fixtures/CubeNorthwindModel.js.map +1 -0
- package/package.json +81 -3
- package/src/__lib__/LegendCubeCommand.ts +44 -0
- package/src/__lib__/LegendCubeHelpText.ts +58 -0
- package/src/__lib__/LegendCubeLabels.ts +171 -0
- package/src/__lib__/LegendCubeTesting.ts +33 -0
- package/src/__test-utils__/CubeCanvasTestUtils.ts +53 -0
- package/src/__test-utils__/CubeEngineTestSupport.ts +172 -0
- package/src/__test-utils__/CubeNorthwindTestQueries.ts +165 -0
- package/src/__test-utils__/CubeOperationsTestUtils.ts +177 -0
- package/src/__test-utils__/CubePageTestUtils.tsx +96 -0
- package/src/__test-utils__/CubeTestApplication.ts +82 -0
- package/src/__test-utils__/FakeCubeEngine.ts +145 -0
- package/src/components/CubeButton.tsx +35 -0
- package/src/components/CubeEditor.tsx +239 -0
- package/src/components/CubeNodeIcon.tsx +64 -0
- package/src/components/canvas/CubeCanvas.tsx +262 -0
- package/src/components/canvas/CubeCanvasContext.ts +31 -0
- package/src/components/canvas/CubeCanvasContextMenu.tsx +89 -0
- package/src/components/canvas/CubeCanvasDnd.ts +82 -0
- package/src/components/canvas/CubeCanvasEdge.tsx +57 -0
- package/src/components/canvas/CubeCanvasElements.ts +153 -0
- package/src/components/canvas/CubeCanvasLayout.ts +88 -0
- package/src/components/canvas/CubeCanvasNode.tsx +149 -0
- package/src/components/editors/CubeColumnPicker.tsx +138 -0
- package/src/components/editors/CubeDistinctEditor.tsx +28 -0
- package/src/components/editors/CubeFilterEditor.tsx +309 -0
- package/src/components/editors/CubeIntegerField.tsx +51 -0
- package/src/components/editors/CubeJoinEditor.tsx +247 -0
- package/src/components/editors/CubeNodeEditorPanel.tsx +215 -0
- package/src/components/editors/CubeNodeEditorRegistry.ts +81 -0
- package/src/components/editors/CubeRenameEditor.tsx +143 -0
- package/src/components/editors/CubeRestrictEditor.tsx +103 -0
- package/src/components/editors/CubeRowCountEditor.tsx +53 -0
- package/src/components/editors/CubeSliceEditor.tsx +69 -0
- package/src/components/editors/CubeSortEditor.tsx +206 -0
- package/src/components/editors/CubeSourceEditor.tsx +106 -0
- package/src/components/editors/CubeValueEditor.tsx +333 -0
- package/src/components/grid/CubeGridRegion.tsx +275 -0
- package/src/components/grid/CubeGridValues.ts +125 -0
- package/src/components/grid/CubeResultGrid.tsx +138 -0
- package/src/components/palette/CubePalette.tsx +177 -0
- package/src/components/show-pure/CubeShowPureDialog.tsx +101 -0
- package/src/components/source-picker/CubeSourcePicker.tsx +304 -0
- package/src/components/spec-transfer/CubeSpecTransferDialog.tsx +157 -0
- package/src/graph-manager/CubeEngine.ts +169 -0
- package/src/graph-manager/CubeModelOutlineHelper.ts +58 -0
- package/src/graph-manager/protocol/pure/CubeEngineBuilder.ts +34 -0
- package/src/graph-manager/protocol/pure/v1/V1_CubeEngineErrors.ts +109 -0
- package/src/graph-manager/protocol/pure/v1/V1_CubeExecutionResultReader.ts +115 -0
- package/src/graph-manager/protocol/pure/v1/V1_CubeLambdaSerializer.ts +257 -0
- package/src/graph-manager/protocol/pure/v1/V1_CubeModelOutlineBuilder.ts +243 -0
- package/src/graph-manager/protocol/pure/v1/V1_CubeRelationTypeAdapter.ts +58 -0
- package/src/graph-manager/protocol/pure/v1/V1_LegendCubeEngine.ts +278 -0
- package/src/graph-manager/protocol/pure/v1/__test-utils__/V1_CubeEngineTestUtils.ts +127 -0
- package/src/index.ts +41 -0
- package/src/stores/CubeEditorState.ts +807 -0
- package/src/stores/CubeExecutionState.ts +288 -0
- package/src/stores/CubeGridQuickActions.ts +129 -0
- package/src/stores/CubeHost.ts +32 -0
- package/src/stores/CubeNodeEditorState.ts +324 -0
- package/src/stores/CubeShowPureState.ts +118 -0
- package/src/stores/CubeSourcePickerState.ts +426 -0
- package/src/stores/CubeSpecTransferState.ts +198 -0
- package/src/stores/LocalModelCatalog.ts +70 -0
- package/src/stores/editors/CubeFilterDraft.ts +241 -0
- package/src/stores/editors/CubeIntegerText.ts +34 -0
- package/src/stores/editors/CubeJoinDraft.ts +224 -0
- package/src/stores/editors/CubeNodeDraft.ts +46 -0
- package/src/stores/editors/CubeNodeDraftRegistry.ts +83 -0
- package/src/stores/editors/CubeRenameDraft.ts +110 -0
- package/src/stores/editors/CubeRestrictDraft.ts +83 -0
- package/src/stores/editors/CubeRowCountDraft.ts +69 -0
- package/src/stores/editors/CubeSliceDraft.ts +87 -0
- package/src/stores/editors/CubeSortDraft.ts +135 -0
- package/src/stores/fixtures/CubeNorthwindModel.ts +355 -0
- package/tsconfig.json +133 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CubeButton.d.ts","sourceRoot":"","sources":["../../src/components/CubeButton.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,2FAA2F;AAC3F,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAC/B,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,GAAG;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CActE,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2026-present, Goldman Sachs
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { clsx } from '@finos/legend-art';
|
|
18
|
+
/** A small text button in the page's toolbars and lists, coloured by the theme's tokens */
|
|
19
|
+
export const CubeButton = ({ className, primary, ...props }) => (_jsx("button", { ...props,
|
|
20
|
+
// these buttons never submit a form
|
|
21
|
+
type: "button", className: clsx('h-6 shrink-0 rounded-sm border px-2 text-base enabled:cursor-pointer disabled:cursor-not-allowed disabled:text-[var(--color-text-disabled)]', primary
|
|
22
|
+
? 'border-[var(--color-accent)] bg-[var(--color-accent)] text-[var(--color-text-on-accent)] enabled:hover:bg-[var(--color-accent-hover)] disabled:border-[var(--color-border-default)] disabled:bg-[var(--color-bg-panel-header)]'
|
|
23
|
+
: 'border-[var(--color-border-default)] bg-[var(--color-bg-elevated)] text-[var(--color-text-primary)] enabled:hover:bg-[var(--color-bg-hover)]', className) }));
|
|
24
|
+
//# sourceMappingURL=CubeButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CubeButton.js","sourceRoot":"","sources":["../../src/components/CubeButton.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,2FAA2F;AAC3F,MAAM,CAAC,MAAM,UAAU,GAEnB,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE,CAAC,CACxC,oBACM,KAAK;IACT,oCAAoC;IACpC,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,IAAI,CACb,6IAA6I,EAC7I,OAAO;QACL,CAAC,CAAC,gOAAgO;QAClO,CAAC,CAAC,8IAA8I,EAClJ,SAAS,CACV,GACD,CACH,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
import type { CubeDocument } from '@finos/legend-cube';
|
|
17
|
+
import type { CubeHost } from '../stores/CubeHost.js';
|
|
18
|
+
/**
|
|
19
|
+
* The Legend Cube page: the query above, its results below, both always
|
|
20
|
+
* shown (PLAN §7.1); hiding the graph leaves its header. The host gives it
|
|
21
|
+
* the engine, the models and the application store; the page's state lives
|
|
22
|
+
* as long as the page.
|
|
23
|
+
*/
|
|
24
|
+
export declare const CubeEditor: ((props: {
|
|
25
|
+
host: CubeHost;
|
|
26
|
+
/** The cube to open; an empty one by default */
|
|
27
|
+
initialDocument?: CubeDocument | undefined;
|
|
28
|
+
}) => import("react/jsx-runtime").JSX.Element) & {
|
|
29
|
+
displayName: string;
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=CubeEditor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CubeEditor.d.ts","sourceRoot":"","sources":["../../src/components/CubeEditor.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAUH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAavD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AA6ItD;;;;;GAKG;AACH,eAAO,MAAM,UAAU,WACb;IACN,IAAI,EAAE,QAAQ,CAAC;IACf,gDAAgD;IAChD,eAAe,CAAC,EAAE,YAAY,GAAG,SAAS,CAAC;CAC5C;;CAiDF,CAAC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2026-present, Goldman Sachs
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { getCollapsiblePanelGroupProps, PanelLoadingIndicator, ResizablePanel, ResizablePanelGroup, ResizablePanelSplitter, } from '@finos/legend-art';
|
|
18
|
+
import { useCommands } from '@finos/legend-application';
|
|
19
|
+
import { flowResult } from 'mobx';
|
|
20
|
+
import { observer } from 'mobx-react-lite';
|
|
21
|
+
import { useEffect, useState } from 'react';
|
|
22
|
+
import { UNDO_SHORTCUT_LABEL } from '../__lib__/LegendCubeCommand.js';
|
|
23
|
+
import { CUBE_PENDING_LABEL, formatDisabledReasons, READ_ONLY_CUBE_TITLE, UNSAVED_CUBE_NAME, } from '../__lib__/LegendCubeLabels.js';
|
|
24
|
+
import { LEGEND_CUBE_TEST_ID } from '../__lib__/LegendCubeTesting.js';
|
|
25
|
+
import { CubeEditorState } from '../stores/CubeEditorState.js';
|
|
26
|
+
import { CubeButton } from './CubeButton.js';
|
|
27
|
+
import { CubeCanvas } from './canvas/CubeCanvas.js';
|
|
28
|
+
import { CubeNodeEditorPanel } from './editors/CubeNodeEditorPanel.js';
|
|
29
|
+
import { CubeGridRegion } from './grid/CubeGridRegion.js';
|
|
30
|
+
import { CubePalette } from './palette/CubePalette.js';
|
|
31
|
+
import { CubeShowPureDialog } from './show-pure/CubeShowPureDialog.js';
|
|
32
|
+
import { CubeSourcePicker } from './source-picker/CubeSourcePicker.js';
|
|
33
|
+
import { CubeSpecTransferDialog } from './spec-transfer/CubeSpecTransferDialog.js';
|
|
34
|
+
/** The graph never takes more of the window's height than this, so the results stay in view (spec §17.3) */
|
|
35
|
+
const MAX_GRAPH_SHARE_OF_WINDOW = 0.6;
|
|
36
|
+
/** How wide the node editor opens, in pixels */
|
|
37
|
+
const NODE_EDITOR_WIDTH = 400;
|
|
38
|
+
/** The tallest the graph region may be, following the window's height */
|
|
39
|
+
const useMaxGraphHeight = () => {
|
|
40
|
+
const [windowHeight, setWindowHeight] = useState(() => window.innerHeight);
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
const onResize = () => setWindowHeight(window.innerHeight);
|
|
43
|
+
window.addEventListener('resize', onResize);
|
|
44
|
+
return () => window.removeEventListener('resize', onResize);
|
|
45
|
+
}, []);
|
|
46
|
+
return Math.round(windowHeight * MAX_GRAPH_SHARE_OF_WINDOW);
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* The graph region's header, above the graph and the results: the cube's
|
|
50
|
+
* name, its actions, its pending and read-only notes, and its dialogs. It
|
|
51
|
+
* stays when the graph is hidden; its buttons wrap when the page is narrow.
|
|
52
|
+
*/
|
|
53
|
+
const CubeGraphHeader = observer((props) => {
|
|
54
|
+
const { editorState } = props;
|
|
55
|
+
const { readOnly } = editorState;
|
|
56
|
+
const { showGraph } = editorState.document.meta.presentation;
|
|
57
|
+
return (_jsxs("div", { className: "flex shrink-0 flex-col bg-[var(--color-bg-panel)]", "data-testid": LEGEND_CUBE_TEST_ID.GRAPH_REGION, children: [_jsxs("div", { className: "flex min-h-8 shrink-0 flex-wrap items-center gap-2 border-b border-[var(--color-border-default)] bg-[var(--color-bg-panel-header)] px-2 py-1", children: [_jsx("span", { className: "min-w-24 flex-1 truncate text-lg font-medium", children: editorState.document.name ?? UNSAVED_CUBE_NAME }), editorState.isResolvingSources && (_jsx("span", { className: "shrink-0 text-base text-[var(--color-text-secondary)]", children: CUBE_PENDING_LABEL.RESOLVING_SOURCE })), _jsx(CubeButton, { title: readOnly ? READ_ONLY_CUBE_TITLE : undefined, disabled: readOnly, onClick: () => editorState.sourcePicker.open(), children: "Add table" }), _jsx(CubeButton, { title: readOnly
|
|
58
|
+
? READ_ONLY_CUBE_TITLE
|
|
59
|
+
: `Undo the last change (${UNDO_SHORTCUT_LABEL})`, disabled: !editorState.canUndo, onClick: () => editorState.undo(), children: "Undo" }), _jsx(CubeButton, { title: editorState.execution.canExecute
|
|
60
|
+
? 'Show the Pure query that Execute runs'
|
|
61
|
+
: formatDisabledReasons(editorState.execution.disabledReasons), disabled: !editorState.execution.canExecute, onClick: () => {
|
|
62
|
+
flowResult(editorState.showPure.open()).catch(editorState.host.applicationStore.alertUnhandledError);
|
|
63
|
+
}, children: "Show Pure" }), _jsx(CubeButton, { title: readOnly
|
|
64
|
+
? READ_ONLY_CUBE_TITLE
|
|
65
|
+
: "Show the cube's spec, to copy or download", disabled: readOnly, onClick: () => editorState.specTransfer.openExport(), children: "Export (dev)" }), _jsx(CubeButton, { title: "Open a cube from its spec, in place of this one", onClick: () => editorState.specTransfer.openImport(), children: "Import (dev)" }), _jsx(CubeButton, { title: showGraph
|
|
66
|
+
? 'Hide the graph, leaving more room for the results'
|
|
67
|
+
: 'Show the graph', onClick: () => editorState.setShowGraph(!showGraph), children: showGraph ? 'Hide graph' : 'Show graph' })] }), _jsx(PanelLoadingIndicator, { isLoading: editorState.isResolvingSources }), readOnly && (_jsxs("div", { className: "shrink-0 border-b border-[var(--color-border-default)] bg-[var(--color-status-warn-bg)] px-2 py-1 text-base text-[var(--color-status-warn)]", role: "status", children: [READ_ONLY_CUBE_TITLE, ". You can view and run it."] })), editorState.nodeEditor.notice && (_jsxs("div", { className: "flex shrink-0 items-center gap-2 border-b border-[var(--color-border-default)] bg-[var(--color-status-warn-bg)] px-2 py-1 text-base text-[var(--color-status-warn)]", role: "status", "data-testid": LEGEND_CUBE_TEST_ID.EDITOR_NOTICE, children: [_jsx("span", { className: "min-w-0 flex-1", children: editorState.nodeEditor.notice }), _jsx(CubeButton, { onClick: () => editorState.nodeEditor.dismissNotice(), children: "Dismiss" })] })), _jsx(CubeSourcePicker, { editorState: editorState }), _jsx(CubeSpecTransferDialog, { editorState: editorState }), _jsx(CubeShowPureDialog, { editorState: editorState })] }));
|
|
68
|
+
});
|
|
69
|
+
/**
|
|
70
|
+
* The Legend Cube page: the query above, its results below, both always
|
|
71
|
+
* shown (PLAN §7.1); hiding the graph leaves its header. The host gives it
|
|
72
|
+
* the engine, the models and the application store; the page's state lives
|
|
73
|
+
* as long as the page.
|
|
74
|
+
*/
|
|
75
|
+
export const CubeEditor = observer((props) => {
|
|
76
|
+
const [editorState] = useState(() => new CubeEditorState(props.host, props.initialDocument));
|
|
77
|
+
useEffect(() => () => editorState.dispose(), [editorState]);
|
|
78
|
+
useCommands(editorState);
|
|
79
|
+
const maxGraphHeight = useMaxGraphHeight();
|
|
80
|
+
const isEditorOpen = editorState.nodeEditor.nodeId !== undefined;
|
|
81
|
+
const editorPanel = getCollapsiblePanelGroupProps(!isEditorOpen, {
|
|
82
|
+
size: NODE_EDITOR_WIDTH,
|
|
83
|
+
});
|
|
84
|
+
const { showGraph } = editorState.document.meta.presentation;
|
|
85
|
+
// hiding the graph collapses its panel: the header and the results stay
|
|
86
|
+
// where they are, so the grid keeps its state
|
|
87
|
+
const graphPanel = getCollapsiblePanelGroupProps(!showGraph);
|
|
88
|
+
return (_jsxs("div", { className: "legend-cube flex bg-[var(--color-bg-app)] text-[var(--color-text-primary)]", "data-testid": LEGEND_CUBE_TEST_ID.EDITOR, children: [_jsx(CubePalette, { editorState: editorState }), _jsxs(ResizablePanelGroup, { orientation: "vertical", children: [_jsx(ResizablePanel, { ...editorPanel.remainingPanel, minSize: 320, children: _jsxs("div", { className: "flex h-full min-w-0 flex-1 flex-col", children: [_jsx(CubeGraphHeader, { editorState: editorState }), _jsxs(ResizablePanelGroup, { orientation: "horizontal", children: [_jsx(ResizablePanel, { ...graphPanel.collapsiblePanel, minSize: showGraph ? 96 : 0, maxSize: maxGraphHeight, children: showGraph && _jsx(CubeCanvas, { editorState: editorState }) }), _jsx(ResizablePanelSplitter, { className: showGraph ? '' : 'hidden' }), _jsx(ResizablePanel, { ...graphPanel.remainingPanel, minSize: 96, children: _jsx(CubeGridRegion, { editorState: editorState }) })] })] }) }), _jsx(ResizablePanelSplitter, { className: isEditorOpen ? '' : 'hidden' }), _jsx(ResizablePanel, { ...editorPanel.collapsiblePanel, direction: -1, children: _jsx(CubeNodeEditorPanel, { editorState: editorState }) })] })] }));
|
|
89
|
+
});
|
|
90
|
+
//# sourceMappingURL=CubeEditor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CubeEditor.js","sourceRoot":"","sources":["../../src/components/CubeEditor.tsx"],"names":[],"mappings":";AAAA;;;;;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CAAC,CACF,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
/** Whether a node definition's icon name maps to an icon, rather than the question mark */
|
|
17
|
+
export declare const hasCubeNodeIcon: (name: string) => boolean;
|
|
18
|
+
/** A node type's icon; an unknown name, or an Unknown node, gets a question mark */
|
|
19
|
+
export declare const CubeNodeIcon: React.FC<{
|
|
20
|
+
icon: string | undefined;
|
|
21
|
+
className?: string;
|
|
22
|
+
}>;
|
|
23
|
+
//# sourceMappingURL=CubeNodeIcon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CubeNodeIcon.d.ts","sourceRoot":"","sources":["../../src/components/CubeNodeIcon.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAiCH,2FAA2F;AAC3F,eAAO,MAAM,eAAe,GAAI,MAAM,MAAM,KAAG,OACd,CAAC;AAElC,oFAAoF;AACpF,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC;IAClC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAQA,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2026-present, Goldman Sachs
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { AlignBottomIcon, AlignMiddleIcon, AlignTopIcon, ArrowsJoinIcon, CompressIcon, DataCubeIcon, clsx, FilterIcon, PencilIcon, QuestionSquareIcon, SortIcon, TableIcon, } from '@finos/legend-art';
|
|
18
|
+
/** The icon of each icon name a node definition gives (`NodeDefinition.icon`) */
|
|
19
|
+
const NODE_ICONS = {
|
|
20
|
+
table: TableIcon,
|
|
21
|
+
filter: FilterIcon,
|
|
22
|
+
join: ArrowsJoinIcon,
|
|
23
|
+
limit: AlignTopIcon,
|
|
24
|
+
drop: AlignBottomIcon,
|
|
25
|
+
slice: AlignMiddleIcon,
|
|
26
|
+
distinct: CompressIcon,
|
|
27
|
+
restrict: DataCubeIcon.TableColumns,
|
|
28
|
+
rename: PencilIcon,
|
|
29
|
+
sort: SortIcon,
|
|
30
|
+
};
|
|
31
|
+
/** Whether a node definition's icon name maps to an icon, rather than the question mark */
|
|
32
|
+
export const hasCubeNodeIcon = (name) => Object.hasOwn(NODE_ICONS, name);
|
|
33
|
+
/** A node type's icon; an unknown name, or an Unknown node, gets a question mark */
|
|
34
|
+
export const CubeNodeIcon = (props) => {
|
|
35
|
+
const { icon, className } = props;
|
|
36
|
+
// an own key only: a name such as `constructor` must not reach Object's
|
|
37
|
+
const Icon = icon !== undefined && hasCubeNodeIcon(icon)
|
|
38
|
+
? (NODE_ICONS[icon] ?? QuestionSquareIcon)
|
|
39
|
+
: QuestionSquareIcon;
|
|
40
|
+
return _jsx(Icon, { className: clsx(className) });
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=CubeNodeIcon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CubeNodeIcon.js","sourceRoot":"","sources":["../../src/components/CubeNodeIcon.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,eAAe,EACf,eAAe,EACf,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,IAAI,EACJ,UAAU,EACV,UAAU,EACV,kBAAkB,EAClB,QAAQ,EACR,SAAS,GACV,MAAM,mBAAmB,CAAC;AAE3B,iFAAiF;AACjF,MAAM,UAAU,GAEZ;IACF,KAAK,EAAE,SAAS;IAChB,MAAM,EAAE,UAAU;IAClB,IAAI,EAAE,cAAc;IACpB,KAAK,EAAE,YAAY;IACnB,IAAI,EAAE,eAAe;IACrB,KAAK,EAAE,eAAe;IACtB,QAAQ,EAAE,YAAY;IACtB,QAAQ,EAAE,YAAY,CAAC,YAAY;IACnC,MAAM,EAAE,UAAU;IAClB,IAAI,EAAE,QAAQ;CACf,CAAC;AAEF,2FAA2F;AAC3F,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,IAAY,EAAW,EAAE,CACvD,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;AAElC,oFAAoF;AACpF,MAAM,CAAC,MAAM,YAAY,GAGpB,CAAC,KAAK,EAAE,EAAE;IACb,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;IAClC,wEAAwE;IACxE,MAAM,IAAI,GACR,IAAI,KAAK,SAAS,IAAI,eAAe,CAAC,IAAI,CAAC;QACzC,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,kBAAkB,CAAC;QAC1C,CAAC,CAAC,kBAAkB,CAAC;IACzB,OAAO,KAAC,IAAI,IAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,GAAI,CAAC;AAC9C,CAAC,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
import type { Query } from '@finos/legend-cube';
|
|
17
|
+
import { type Connection as FlowConnection, type Edge } from '@xyflow/react';
|
|
18
|
+
import '@xyflow/react/dist/style.css';
|
|
19
|
+
import type { CubeEditorState } from '../../stores/CubeEditorState.js';
|
|
20
|
+
/**
|
|
21
|
+
* Whether dragging from one handle to another may connect the two nodes: out
|
|
22
|
+
* of a node's output, into a free input port that the query lets it feed
|
|
23
|
+
*/
|
|
24
|
+
export declare const isCubeCanvasConnectionValid: (query: Query, connection: FlowConnection | Edge) => boolean;
|
|
25
|
+
/**
|
|
26
|
+
* The query as a graph, laid out left to right (spec §17.3). Click a node to
|
|
27
|
+
* edit it, Ctrl or Cmd-click it to run the query up to it, drag from a node's
|
|
28
|
+
* output to another node's input to connect them. A palette item dropped
|
|
29
|
+
* around the nodes is added unconnected. Right-click it, or a node, for the
|
|
30
|
+
* context menu.
|
|
31
|
+
*/
|
|
32
|
+
export declare const CubeCanvas: ((props: {
|
|
33
|
+
editorState: CubeEditorState;
|
|
34
|
+
}) => import("react/jsx-runtime").JSX.Element) & {
|
|
35
|
+
displayName: string;
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=CubeCanvas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CubeCanvas.d.ts","sourceRoot":"","sources":["../../../src/components/canvas/CubeCanvas.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAEL,KAAK,UAAU,IAAI,cAAc,EAEjC,KAAK,IAAI,EAOV,MAAM,eAAe,CAAC;AAGvB,OAAO,8BAA8B,CAAC;AAKtC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AA6BvE;;;GAGG;AACH,eAAO,MAAM,2BAA2B,GACtC,OAAO,KAAK,EACZ,YAAY,cAAc,GAAG,IAAI,KAChC,OAOA,CAAC;AAqHJ;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,WACb;IAAE,WAAW,EAAE,eAAe,CAAA;CAAE;;CAuDzC,CAAC"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2026-present, Goldman Sachs
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { ContextMenu } from '@finos/legend-art';
|
|
18
|
+
import { noop } from '@finos/legend-shared';
|
|
19
|
+
import { Background, Controls, MiniMap, ReactFlow, ReactFlowProvider, useNodesInitialized, useReactFlow, useStore, } from '@xyflow/react';
|
|
20
|
+
// imported here, not in the builder's stylesheet, so it loads with the Cube
|
|
21
|
+
// page's chunk: Query's reactflow 11 lineage viewer uses the same class names
|
|
22
|
+
import '@xyflow/react/dist/style.css';
|
|
23
|
+
import { observer } from 'mobx-react-lite';
|
|
24
|
+
import { useEffect, useMemo, useRef } from 'react';
|
|
25
|
+
import { useDrop } from 'react-dnd';
|
|
26
|
+
import { LEGEND_CUBE_TEST_ID } from '../../__lib__/LegendCubeTesting.js';
|
|
27
|
+
import { buildCubeCanvasEdges, buildCubeCanvasNodes, CUBE_CANVAS_EDGE_TYPE, CUBE_CANVAS_NODE_TYPE, CUBE_OUTPUT_HANDLE_ID, } from './CubeCanvasElements.js';
|
|
28
|
+
import { CubeCanvasContext } from './CubeCanvasContext.js';
|
|
29
|
+
import { CubeCanvasContextMenu } from './CubeCanvasContextMenu.js';
|
|
30
|
+
import { CUBE_DND_TYPE, dropOnCubeCanvas, } from './CubeCanvasDnd.js';
|
|
31
|
+
import { CubeCanvasEdge } from './CubeCanvasEdge.js';
|
|
32
|
+
import { layoutCubeQuery } from './CubeCanvasLayout.js';
|
|
33
|
+
import { CubeCanvasNode } from './CubeCanvasNode.js';
|
|
34
|
+
// React Flow re-renders every node when these change identity
|
|
35
|
+
const NODE_TYPES = { [CUBE_CANVAS_NODE_TYPE]: CubeCanvasNode };
|
|
36
|
+
const EDGE_TYPES = { [CUBE_CANVAS_EDGE_TYPE]: CubeCanvasEdge };
|
|
37
|
+
const PRO_OPTIONS = { hideAttribution: true };
|
|
38
|
+
/** Small, so it covers little of a short canvas */
|
|
39
|
+
const MINI_MAP_STYLE = { width: 120, height: 80 };
|
|
40
|
+
const FIT_VIEW_OPTIONS = { padding: 0.2, maxZoom: 1 };
|
|
41
|
+
/**
|
|
42
|
+
* Whether dragging from one handle to another may connect the two nodes: out
|
|
43
|
+
* of a node's output, into a free input port that the query lets it feed
|
|
44
|
+
*/
|
|
45
|
+
export const isCubeCanvasConnectionValid = (query, connection) => connection.sourceHandle === CUBE_OUTPUT_HANDLE_ID &&
|
|
46
|
+
typeof connection.targetHandle === 'string' &&
|
|
47
|
+
query.canConnect(connection.source, connection.target, connection.targetHandle);
|
|
48
|
+
const CubeCanvasFlow = observer((props) => {
|
|
49
|
+
const { editorState } = props;
|
|
50
|
+
const { query } = editorState.document;
|
|
51
|
+
const { readOnly } = editorState;
|
|
52
|
+
const { fitView } = useReactFlow();
|
|
53
|
+
const positions = useMemo(() => layoutCubeQuery(query), [query]);
|
|
54
|
+
const nodes = useMemo(() => buildCubeCanvasNodes(query, positions), [query, positions]);
|
|
55
|
+
const edges = useMemo(() => buildCubeCanvasEdges(query), [query]);
|
|
56
|
+
// the view fits the graph again whenever the layout moves a node, or the
|
|
57
|
+
// canvas changes size (e.g. the node editor opens beside it, or the
|
|
58
|
+
// splitter above the grid moves), once React Flow has measured every node:
|
|
59
|
+
// it fits only measured ones
|
|
60
|
+
const layoutSignature = useMemo(() => JSON.stringify([...positions]), [positions]);
|
|
61
|
+
const nodesInitialized = useNodesInitialized();
|
|
62
|
+
const canvasWidth = useStore((state) => state.width);
|
|
63
|
+
const canvasHeight = useStore((state) => state.height);
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
if (!nodesInitialized) {
|
|
66
|
+
return undefined;
|
|
67
|
+
}
|
|
68
|
+
const timer = window.setTimeout(() => {
|
|
69
|
+
fitView(FIT_VIEW_OPTIONS).catch(noop());
|
|
70
|
+
}, 0);
|
|
71
|
+
return () => window.clearTimeout(timer);
|
|
72
|
+
}, [layoutSignature, canvasWidth, canvasHeight, nodesInitialized, fitView]);
|
|
73
|
+
return (_jsxs(ReactFlow, { nodes: nodes, edges: edges, nodeTypes: NODE_TYPES, edgeTypes: EDGE_TYPES,
|
|
74
|
+
// the layout places the nodes; nothing is selected or deleted in React Flow
|
|
75
|
+
nodesDraggable: false, nodesConnectable: !readOnly, elementsSelectable: false, deleteKeyCode: null, selectionKeyCode: null, multiSelectionKeyCode: null, onNodeClick: (event, flowNode) => {
|
|
76
|
+
// a click on a handle starts or ends a connection, not a node click
|
|
77
|
+
if (event.target instanceof Element &&
|
|
78
|
+
event.target.closest('.react-flow__handle')) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (event.ctrlKey || event.metaKey) {
|
|
82
|
+
editorState.select(flowNode.id);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
editorState.nodeEditor.open(flowNode.id);
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
// React Flow's own keyboard help speaks of selecting, moving and
|
|
89
|
+
// deleting nodes, which Cube doesn't do; Enter and Space open a node's
|
|
90
|
+
// editor instead, and Ctrl or Cmd with them select it
|
|
91
|
+
disableKeyboardA11y: true, edgesFocusable: false, onKeyDown: (event) => {
|
|
92
|
+
const target = event.target;
|
|
93
|
+
const nodeId = target instanceof HTMLElement &&
|
|
94
|
+
target.classList.contains('react-flow__node')
|
|
95
|
+
? target.dataset.id
|
|
96
|
+
: undefined;
|
|
97
|
+
if (nodeId === undefined ||
|
|
98
|
+
(event.key !== 'Enter' && event.key !== ' ')) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
event.preventDefault();
|
|
102
|
+
if (event.ctrlKey || event.metaKey) {
|
|
103
|
+
editorState.select(nodeId);
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
editorState.nodeEditor.open(nodeId);
|
|
107
|
+
}
|
|
108
|
+
}, isValidConnection: (connection) => !readOnly && isCubeCanvasConnectionValid(query, connection), onConnect: (connection) => {
|
|
109
|
+
if (connection.targetHandle) {
|
|
110
|
+
editorState.connect(connection.source, connection.target, connection.targetHandle);
|
|
111
|
+
}
|
|
112
|
+
}, colorMode: editorState.host.applicationStore.layoutService
|
|
113
|
+
.TEMPORARY__isLightColorThemeEnabled
|
|
114
|
+
? 'light'
|
|
115
|
+
: 'dark', proOptions: PRO_OPTIONS, fitView: true, fitViewOptions: FIT_VIEW_OPTIONS, minZoom: 0.2, maxZoom: 1.5, children: [_jsx(Background, {}), _jsx(Controls, { showInteractive: false }), _jsx(MiniMap, { pannable: true, zoomable: true, style: MINI_MAP_STYLE })] }));
|
|
116
|
+
});
|
|
117
|
+
/**
|
|
118
|
+
* The query as a graph, laid out left to right (spec §17.3). Click a node to
|
|
119
|
+
* edit it, Ctrl or Cmd-click it to run the query up to it, drag from a node's
|
|
120
|
+
* output to another node's input to connect them. A palette item dropped
|
|
121
|
+
* around the nodes is added unconnected. Right-click it, or a node, for the
|
|
122
|
+
* context menu.
|
|
123
|
+
*/
|
|
124
|
+
export const CubeCanvas = observer((props) => {
|
|
125
|
+
const { editorState } = props;
|
|
126
|
+
const ref = useRef(null);
|
|
127
|
+
const [, dropConnector] = useDrop(() => ({
|
|
128
|
+
accept: [CUBE_DND_TYPE.PALETTE_ITEM],
|
|
129
|
+
canDrop: () => !editorState.readOnly,
|
|
130
|
+
// a node under the pointer, whether it took the drop or refused it,
|
|
131
|
+
// keeps it from the canvas
|
|
132
|
+
drop: (item, monitor) => dropOnCubeCanvas(editorState, item, monitor.didDrop() || !monitor.isOver({ shallow: true })),
|
|
133
|
+
}), [editorState]);
|
|
134
|
+
dropConnector(ref);
|
|
135
|
+
return (_jsx("div", { ref: ref, className: "relative h-full w-full", "data-testid": LEGEND_CUBE_TEST_ID.CANVAS, children: _jsx(ContextMenu, { className: "h-full w-full", content: _jsx(CubeCanvasContextMenu, { editorState: editorState }), menuProps: { elevation: 7 }, children: editorState.document.query.isEmpty ? (_jsx("div", { className: "flex h-full items-center justify-center p-4 text-base text-[var(--color-text-secondary)]", children: _jsxs("span", { children: ["No tables yet:", ' ', _jsx("button", { className: "text-[var(--color-accent)] underline disabled:text-[var(--color-text-disabled)] disabled:no-underline", disabled: editorState.readOnly, onClick: () => editorState.sourcePicker.open(), children: "add a table" }), ' ', "to start."] }) })) : (_jsx(CubeCanvasContext.Provider, { value: editorState, children: _jsx(ReactFlowProvider, { children: _jsx(CubeCanvasFlow, { editorState: editorState }) }) })) }) }));
|
|
136
|
+
});
|
|
137
|
+
//# sourceMappingURL=CubeCanvas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CubeCanvas.js","sourceRoot":"","sources":["../../../src/components/canvas/CubeCanvas.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EACL,UAAU,EAEV,QAAQ,EAER,OAAO,EACP,SAAS,EACT,iBAAiB,EACjB,mBAAmB,EACnB,YAAY,EACZ,QAAQ,GACT,MAAM,eAAe,CAAC;AACvB,4EAA4E;AAC5E,8EAA8E;AAC9E,OAAO,8BAA8B,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAEzE,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,GAGtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EACL,aAAa,EAEb,gBAAgB,GACjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,cAAc,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@
|
|
|
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
|
+
import type { CubeEditorState } from '../../stores/CubeEditorState.js';
|
|
17
|
+
export declare const CubeCanvasContext: import("react").Context<CubeEditorState | undefined>;
|
|
18
|
+
export declare const useCubeCanvasEditorState: () => CubeEditorState;
|
|
19
|
+
//# sourceMappingURL=CubeCanvasContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CubeCanvasContext.d.ts","sourceRoot":"","sources":["../../../src/components/canvas/CubeCanvasContext.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAIvE,eAAO,MAAM,iBAAiB,sDAE7B,CAAC;AAEF,eAAO,MAAM,wBAAwB,QAAO,eAIzC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
import { guaranteeNonNullable } from '@finos/legend-shared';
|
|
17
|
+
import { createContext, useContext } from 'react';
|
|
18
|
+
// React Flow renders the canvas's nodes itself, so they reach the page's
|
|
19
|
+
// state through a context rather than props
|
|
20
|
+
export const CubeCanvasContext = createContext(undefined);
|
|
21
|
+
export const useCubeCanvasEditorState = () => guaranteeNonNullable(useContext(CubeCanvasContext), `A canvas node must be rendered inside the Cube canvas`);
|
|
22
|
+
//# sourceMappingURL=CubeCanvasContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CubeCanvasContext.js","sourceRoot":"","sources":["../../../src/components/canvas/CubeCanvasContext.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAGlD,yEAAyE;AACzE,4CAA4C;AAC5C,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAa,CAC5C,SAAS,CACV,CAAC;AAEF,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAoB,EAAE,CAC5D,oBAAoB,CAClB,UAAU,CAAC,iBAAiB,CAAC,EAC7B,uDAAuD,CACxD,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
import type { CubeEditorState } from '../../stores/CubeEditorState.js';
|
|
17
|
+
/**
|
|
18
|
+
* The canvas's context menu (spec §17.4): the palette, then what can be done
|
|
19
|
+
* to the node it was opened on. On a node, a palette item is added after it;
|
|
20
|
+
* around the nodes, on its own. Every item shows, disabled when it can't be
|
|
21
|
+
* done, so Swap Inputs can be found. The node comes through props: a menu
|
|
22
|
+
* opened around the nodes has none.
|
|
23
|
+
*/
|
|
24
|
+
export declare const CubeCanvasContextMenu: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Omit<{
|
|
25
|
+
editorState: CubeEditorState;
|
|
26
|
+
nodeId?: string | undefined;
|
|
27
|
+
} & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>>;
|
|
28
|
+
//# sourceMappingURL=CubeCanvasContextMenu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CubeCanvasContextMenu.d.ts","sourceRoot":"","sources":["../../../src/components/canvas/CubeCanvasContextMenu.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAYH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAGvE;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB;iBAGf,eAAe;aAAW,MAAM,GAAG,SAAS;2GAiD9D,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2026-present, Goldman Sachs
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { MenuContent, MenuContentDivider, MenuContentItem, MenuContentItemIcon, MenuContentItemLabel, } from '@finos/legend-art';
|
|
18
|
+
import { observer } from 'mobx-react-lite';
|
|
19
|
+
import { forwardRef } from 'react';
|
|
20
|
+
import { CubeNodeIcon } from '../CubeNodeIcon.js';
|
|
21
|
+
/**
|
|
22
|
+
* The canvas's context menu (spec §17.4): the palette, then what can be done
|
|
23
|
+
* to the node it was opened on. On a node, a palette item is added after it;
|
|
24
|
+
* around the nodes, on its own. Every item shows, disabled when it can't be
|
|
25
|
+
* done, so Swap Inputs can be found. The node comes through props: a menu
|
|
26
|
+
* opened around the nodes has none.
|
|
27
|
+
*/
|
|
28
|
+
export const CubeCanvasContextMenu = observer(forwardRef(function CubeCanvasContextMenu(props, ref) {
|
|
29
|
+
const { editorState, nodeId } = props;
|
|
30
|
+
const { query } = editorState.document;
|
|
31
|
+
const { registry } = editorState;
|
|
32
|
+
const paletteItem = (definition) => (_jsxs(MenuContentItem, { disabled: !editorState.canAddNode(definition.type, nodeId), onClick: () => editorState.addNode(definition.type, nodeId), children: [_jsx(MenuContentItemIcon, { children: _jsx(CubeNodeIcon, { icon: definition.icon }) }), _jsxs(MenuContentItemLabel, { children: [definition.label, definition.beta ? ' (BETA)' : ''] })] }, definition.type));
|
|
33
|
+
return (_jsxs(MenuContent, { ref: ref, children: [registry.sources.map(paletteItem), _jsx(MenuContentDivider, {}), registry.transforms.map(paletteItem), _jsx(MenuContentDivider, {}), _jsx(MenuContentItem, { title: "Execute runs the query up to this node", disabled: nodeId === undefined || !query.canSelect(nodeId), onClick: () => nodeId !== undefined && editorState.select(nodeId), children: "Select" }), _jsx(MenuContentItem, { disabled: nodeId === undefined || !editorState.canRemoveNode(nodeId), onClick: () => nodeId !== undefined && editorState.removeNode(nodeId), children: "Remove" }), _jsx(MenuContentItem, { title: "Swap the node's two inputs, e.g. a Join's Left and Right", disabled: nodeId === undefined || !editorState.canSwapInputs(nodeId), onClick: () => nodeId !== undefined && editorState.swapInputs(nodeId), children: "Swap Inputs" })] }));
|
|
34
|
+
}));
|
|
35
|
+
//# sourceMappingURL=CubeCanvasContextMenu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CubeCanvasContextMenu.js","sourceRoot":"","sources":["../../../src/components/canvas/CubeCanvasContextMenu.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,QAAQ,CAC3C,UAAU,CAGR,SAAS,qBAAqB,CAAC,KAAK,EAAE,GAAG;IACzC,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IACtC,MAAM,EAAE,KAAK,EAAE,GAAG,WAAW,CAAC,QAAQ,CAAC;IACvC,MAAM,EAAE,QAAQ,EAAE,GAAG,WAAW,CAAC;IACjC,MAAM,WAAW,GAAG,CAAC,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,WAAW,CAAC,aAAa,CAAC,MAAM,CAAC,EACpE,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,KAAK,SAAS,IAAI,WAAW,CAAC,UAAU,CAAC,MAAM,CAAC,4BAGrD,IACN,CACf,CAAC;AACJ,CAAC,CAAC,CACH,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
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
|
+
import type { CubeEditorState } from '../../stores/CubeEditorState.js';
|
|
17
|
+
export declare enum CUBE_DND_TYPE {
|
|
18
|
+
PALETTE_ITEM = "legend-cube.palette-item",
|
|
19
|
+
NODE = "legend-cube.node"
|
|
20
|
+
}
|
|
21
|
+
/** A palette item carries the type of node it adds */
|
|
22
|
+
export interface CubePaletteDragItem {
|
|
23
|
+
readonly nodeType: string;
|
|
24
|
+
}
|
|
25
|
+
/** A node carries only its id */
|
|
26
|
+
export interface CubeNodeDragItem {
|
|
27
|
+
readonly nodeId: string;
|
|
28
|
+
}
|
|
29
|
+
export type CubeDragItem = CubePaletteDragItem | CubeNodeDragItem;
|
|
30
|
+
/**
|
|
31
|
+
* Whether dropping the item on the node does anything, which also decides
|
|
32
|
+
* whether the node lights up under it: a palette item is spliced in after
|
|
33
|
+
* the node, another node connects to it or else moves after it
|
|
34
|
+
*/
|
|
35
|
+
export declare const canDropOnCubeNode: (editorState: CubeEditorState, item: CubeDragItem, targetId: string) => boolean;
|
|
36
|
+
export declare const dropOnCubeNode: (editorState: CubeEditorState, item: CubeDragItem, targetId: string) => void;
|
|
37
|
+
/**
|
|
38
|
+
* A palette item dropped on the canvas around the nodes: a transform is
|
|
39
|
+
* added unconnected, a source opens the picker. A drop on a node is the
|
|
40
|
+
* node's, taken or refused, never the canvas's.
|
|
41
|
+
*/
|
|
42
|
+
export declare const dropOnCubeCanvas: (editorState: CubeEditorState, item: CubeDragItem, isOverNode: boolean) => void;
|
|
43
|
+
//# sourceMappingURL=CubeCanvasDnd.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CubeCanvasDnd.d.ts","sourceRoot":"","sources":["../../../src/components/canvas/CubeCanvasDnd.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAMvE,oBAAY,aAAa;IACvB,YAAY,6BAA6B;IACzC,IAAI,qBAAqB;CAC1B;AAED,sDAAsD;AACtD,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED,iCAAiC;AACjC,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,MAAM,YAAY,GAAG,mBAAmB,GAAG,gBAAgB,CAAC;AAKlE;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAC5B,aAAa,eAAe,EAC5B,MAAM,YAAY,EAClB,UAAU,MAAM,KACf,OAGkD,CAAC;AAEtD,eAAO,MAAM,cAAc,GACzB,aAAa,eAAe,EAC5B,MAAM,YAAY,EAClB,UAAU,MAAM,KACf,IAMF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,GAC3B,aAAa,eAAe,EAC5B,MAAM,YAAY,EAClB,YAAY,OAAO,KAClB,IAIF,CAAC"}
|