@solidxai/core-ui 0.1.13-beta.1 → 0.1.13-beta.2
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/dist/components/common/SolidFieldTooltip.d.ts.map +1 -1
- package/dist/components/common/SolidFieldTooltip.js +33 -1
- package/dist/components/common/SolidFieldTooltip.js.map +1 -1
- package/dist/components/common/SolidFieldTooltip.tsx +64 -8
- package/dist/components/core/chatter/SolidChatter.d.ts.map +1 -1
- package/dist/components/core/chatter/SolidChatter.js +4 -2
- package/dist/components/core/chatter/SolidChatter.js.map +1 -1
- package/dist/components/core/chatter/SolidChatter.tsx +4 -1
- package/dist/components/core/chatter/SolidChatterMentionMenu.d.ts +9 -0
- package/dist/components/core/chatter/SolidChatterMentionMenu.d.ts.map +1 -0
- package/dist/components/core/chatter/SolidChatterMentionMenu.js +18 -0
- package/dist/components/core/chatter/SolidChatterMentionMenu.js.map +1 -0
- package/dist/components/core/chatter/SolidChatterMentionMenu.tsx +45 -0
- package/dist/components/core/chatter/SolidChatterMessageBox.d.ts +1 -0
- package/dist/components/core/chatter/SolidChatterMessageBox.d.ts.map +1 -1
- package/dist/components/core/chatter/SolidChatterMessageBox.js +29 -5
- package/dist/components/core/chatter/SolidChatterMessageBox.js.map +1 -1
- package/dist/components/core/chatter/SolidChatterMessageBox.tsx +57 -4
- package/dist/components/core/chatter/SolidMessageComposer.d.ts.map +1 -1
- package/dist/components/core/chatter/SolidMessageComposer.js +33 -7
- package/dist/components/core/chatter/SolidMessageComposer.js.map +1 -1
- package/dist/components/core/chatter/SolidMessageComposer.tsx +61 -7
- package/dist/components/core/chatter/chatter.module.css +63 -0
- package/dist/components/core/chatter/chatterMentions.d.ts +17 -0
- package/dist/components/core/chatter/chatterMentions.d.ts.map +1 -0
- package/dist/components/core/chatter/chatterMentions.js +50 -0
- package/dist/components/core/chatter/chatterMentions.js.map +1 -0
- package/dist/components/core/chatter/chatterMentions.ts +59 -0
- package/dist/components/core/chatter/useChatterMentions.d.ts +26 -0
- package/dist/components/core/chatter/useChatterMentions.d.ts.map +1 -0
- package/dist/components/core/chatter/useChatterMentions.js +204 -0
- package/dist/components/core/chatter/useChatterMentions.js.map +1 -0
- package/dist/components/core/chatter/useChatterMentions.ts +160 -0
- package/dist/components/core/extension/solid-core/workflowDefinition/list/openWorkflowDefinitionEditorHeaderAction.d.ts +8 -0
- package/dist/components/core/extension/solid-core/workflowDefinition/list/openWorkflowDefinitionEditorHeaderAction.d.ts.map +1 -0
- package/dist/components/core/extension/solid-core/workflowDefinition/list/openWorkflowDefinitionEditorHeaderAction.js +6 -0
- package/dist/components/core/extension/solid-core/workflowDefinition/list/openWorkflowDefinitionEditorHeaderAction.js.map +1 -0
- package/dist/components/core/extension/solid-core/workflowDefinition/list/openWorkflowDefinitionEditorHeaderAction.ts +13 -0
- package/dist/components/core/extension/solid-core/workflowDefinition/list/openWorkflowDefinitionEditorRowAction.d.ts +11 -0
- package/dist/components/core/extension/solid-core/workflowDefinition/list/openWorkflowDefinitionEditorRowAction.d.ts.map +1 -0
- package/dist/components/core/extension/solid-core/workflowDefinition/list/openWorkflowDefinitionEditorRowAction.js +10 -0
- package/dist/components/core/extension/solid-core/workflowDefinition/list/openWorkflowDefinitionEditorRowAction.js.map +1 -0
- package/dist/components/core/extension/solid-core/workflowDefinition/list/openWorkflowDefinitionEditorRowAction.ts +22 -0
- package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.d.ts +1 -1
- package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.d.ts.map +1 -1
- package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.js +4 -0
- package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.js.map +1 -1
- package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.tsx +6 -0
- package/dist/components/core/list/SolidCustomListColumn.d.ts +8 -0
- package/dist/components/core/list/SolidCustomListColumn.d.ts.map +1 -0
- package/dist/components/core/list/SolidCustomListColumn.js +47 -0
- package/dist/components/core/list/SolidCustomListColumn.js.map +1 -0
- package/dist/components/core/list/SolidCustomListColumn.tsx +57 -0
- package/dist/components/core/list/SolidListView.d.ts.map +1 -1
- package/dist/components/core/list/SolidListView.js +4 -3
- package/dist/components/core/list/SolidListView.js.map +1 -1
- package/dist/components/core/list/SolidListView.tsx +4 -3
- package/dist/components/core/model/CreateModel.d.ts.map +1 -1
- package/dist/components/core/model/CreateModel.js +3 -2
- package/dist/components/core/model/CreateModel.js.map +1 -1
- package/dist/components/core/model/CreateModel.tsx +4 -1
- package/dist/components/core/model/FieldMetaData.d.ts +1 -1
- package/dist/components/core/model/FieldMetaData.d.ts.map +1 -1
- package/dist/components/core/model/FieldMetaData.js +17 -17
- package/dist/components/core/model/FieldMetaData.js.map +1 -1
- package/dist/components/core/model/FieldMetaData.tsx +10 -2
- package/dist/components/shad-cn-ui/SolidTextarea.d.ts +1 -1
- package/dist/components/shad-cn-ui/SolidTextarea.d.ts.map +1 -1
- package/dist/components/shad-cn-ui/SolidTextarea.js +4 -3
- package/dist/components/shad-cn-ui/SolidTextarea.js.map +1 -1
- package/dist/components/shad-cn-ui/SolidTextarea.tsx +4 -2
- package/dist/components/workflow/WorkflowFlowCanvas.css +431 -0
- package/dist/components/workflow/WorkflowFlowCanvas.d.ts +41 -0
- package/dist/components/workflow/WorkflowFlowCanvas.d.ts.map +1 -0
- package/dist/components/workflow/WorkflowFlowCanvas.js +705 -0
- package/dist/components/workflow/WorkflowFlowCanvas.js.map +1 -0
- package/dist/components/workflow/WorkflowFlowCanvas.tsx +1274 -0
- package/dist/components/workflow/WorkflowNodeDocsPanel.css +247 -0
- package/dist/components/workflow/WorkflowNodeDocsPanel.d.ts +22 -0
- package/dist/components/workflow/WorkflowNodeDocsPanel.d.ts.map +1 -0
- package/dist/components/workflow/WorkflowNodeDocsPanel.js +97 -0
- package/dist/components/workflow/WorkflowNodeDocsPanel.js.map +1 -0
- package/dist/components/workflow/WorkflowNodeDocsPanel.tsx +363 -0
- package/dist/components/workflow/WorkflowNodeSchemaEditor.d.ts +50 -0
- package/dist/components/workflow/WorkflowNodeSchemaEditor.d.ts.map +1 -0
- package/dist/components/workflow/WorkflowNodeSchemaEditor.js +309 -0
- package/dist/components/workflow/WorkflowNodeSchemaEditor.js.map +1 -0
- package/dist/components/workflow/WorkflowNodeSchemaEditor.tsx +808 -0
- package/dist/helpers/modulePackageResumeState.d.ts +6 -0
- package/dist/helpers/modulePackageResumeState.d.ts.map +1 -0
- package/dist/helpers/modulePackageResumeState.js +46 -0
- package/dist/helpers/modulePackageResumeState.js.map +1 -0
- package/dist/helpers/modulePackageResumeState.ts +57 -0
- package/dist/redux/api/workflowDefinitionEditorApi.d.ts +17 -0
- package/dist/redux/api/workflowDefinitionEditorApi.d.ts.map +1 -0
- package/dist/redux/api/workflowDefinitionEditorApi.js +38 -0
- package/dist/redux/api/workflowDefinitionEditorApi.js.map +1 -0
- package/dist/redux/api/workflowDefinitionEditorApi.ts +40 -0
- package/dist/redux/api/workflowNodeApi.d.ts +6 -0
- package/dist/redux/api/workflowNodeApi.d.ts.map +1 -0
- package/dist/redux/api/workflowNodeApi.js +14 -0
- package/dist/redux/api/workflowNodeApi.js.map +1 -0
- package/dist/redux/api/workflowNodeApi.ts +18 -0
- package/dist/resources/globals.css +14 -0
- package/dist/resources/shadcn-base.css +70 -16
- package/dist/routes/pages/admin/core/WorkflowDefinitionEditorPage.css +970 -0
- package/dist/routes/pages/admin/core/WorkflowDefinitionEditorPage.d.ts +3 -0
- package/dist/routes/pages/admin/core/WorkflowDefinitionEditorPage.d.ts.map +1 -0
- package/dist/routes/pages/admin/core/WorkflowDefinitionEditorPage.js +1287 -0
- package/dist/routes/pages/admin/core/WorkflowDefinitionEditorPage.js.map +1 -0
- package/dist/routes/pages/admin/core/WorkflowDefinitionEditorPage.tsx +2572 -0
- package/dist/routes/pages/admin/core/WorkflowDefinitionListPage.css +151 -0
- package/dist/routes/pages/admin/core/WorkflowDefinitionListPage.d.ts +3 -0
- package/dist/routes/pages/admin/core/WorkflowDefinitionListPage.d.ts.map +1 -0
- package/dist/routes/pages/admin/core/WorkflowDefinitionListPage.js +250 -0
- package/dist/routes/pages/admin/core/WorkflowDefinitionListPage.js.map +1 -0
- package/dist/routes/pages/admin/core/WorkflowDefinitionListPage.tsx +455 -0
- package/dist/types/workflow-node.d.ts +127 -0
- package/dist/types/workflow-node.d.ts.map +1 -0
- package/dist/types/workflow-node.js +2 -0
- package/dist/types/workflow-node.js.map +1 -0
- package/dist/types/workflow-node.ts +162 -0
- package/package.json +1 -1
- package/dist/components/auth/SolidOTPVerify.d.ts +0 -3
- package/dist/components/auth/SolidOTPVerify.d.ts.map +0 -1
- package/dist/components/auth/SolidOTPVerify.js +0 -67
- package/dist/components/auth/SolidOTPVerify.js.map +0 -1
- package/dist/components/auth/SolidOTPVerify.tsx +0 -133
- package/dist/components/common/AuthBanner.d.ts +0 -3
- package/dist/components/common/AuthBanner.d.ts.map +0 -1
- package/dist/components/common/AuthBanner.js +0 -15
- package/dist/components/common/AuthBanner.js.map +0 -1
- package/dist/components/common/AuthBanner.tsx +0 -41
- package/dist/components/common/SingleSelectAutoCompleteField.d.ts +0 -2
- package/dist/components/common/SingleSelectAutoCompleteField.d.ts.map +0 -1
- package/dist/components/common/SingleSelectAutoCompleteField.js +0 -92
- package/dist/components/common/SingleSelectAutoCompleteField.js.map +0 -1
- package/dist/components/common/SingleSelectAutoCompleteField.tsx +0 -73
- package/dist/components/common/SolidExportStepper.d.ts +0 -12
- package/dist/components/common/SolidExportStepper.d.ts.map +0 -1
- package/dist/components/common/SolidExportStepper.js +0 -30
- package/dist/components/common/SolidExportStepper.js.map +0 -1
- package/dist/components/common/SolidExportStepper.tsx +0 -135
- package/dist/components/core/common/LoadDynamicJsxComponent.d.ts +0 -2
- package/dist/components/core/common/LoadDynamicJsxComponent.d.ts.map +0 -1
- package/dist/components/core/common/LoadDynamicJsxComponent.js +0 -50
- package/dist/components/core/common/LoadDynamicJsxComponent.js.map +0 -1
- package/dist/components/core/common/LoadDynamicJsxComponent.tsx +0 -70
- package/dist/components/core/common/SolidGenericImport/SolidImportWrapper.d.ts +0 -2
- package/dist/components/core/common/SolidGenericImport/SolidImportWrapper.d.ts.map +0 -1
- package/dist/components/core/common/SolidGenericImport/SolidImportWrapper.js +0 -16
- package/dist/components/core/common/SolidGenericImport/SolidImportWrapper.js.map +0 -1
- package/dist/components/core/common/SolidGenericImport/SolidImportWrapper.tsx +0 -29
- package/dist/components/core/dashboard/DashboardFilter.d.ts +0 -13
- package/dist/components/core/dashboard/DashboardFilter.d.ts.map +0 -1
- package/dist/components/core/dashboard/DashboardFilter.js +0 -299
- package/dist/components/core/dashboard/DashboardFilter.js.map +0 -1
- package/dist/components/core/dashboard/DashboardFilter.tsx +0 -348
- package/dist/components/core/dashboard/PrimeDataTableWrapper.d.ts +0 -3
- package/dist/components/core/dashboard/PrimeDataTableWrapper.d.ts.map +0 -1
- package/dist/components/core/dashboard/PrimeDataTableWrapper.js +0 -21
- package/dist/components/core/dashboard/PrimeDataTableWrapper.js.map +0 -1
- package/dist/components/core/dashboard/PrimeDataTableWrapper.tsx +0 -40
- package/dist/components/core/dashboard/SolidDashboard.d.ts +0 -28
- package/dist/components/core/dashboard/SolidDashboard.d.ts.map +0 -1
- package/dist/components/core/dashboard/SolidDashboard.js +0 -183
- package/dist/components/core/dashboard/SolidDashboard.js.map +0 -1
- package/dist/components/core/dashboard/SolidDashboard.module.css +0 -83
- package/dist/components/core/dashboard/SolidDashboard.tsx +0 -263
- package/dist/components/core/dashboard/SolidDashboardBody.d.ts +0 -24
- package/dist/components/core/dashboard/SolidDashboardBody.d.ts.map +0 -1
- package/dist/components/core/dashboard/SolidDashboardBody.js +0 -162
- package/dist/components/core/dashboard/SolidDashboardBody.js.map +0 -1
- package/dist/components/core/dashboard/SolidDashboardBody.tsx +0 -168
- package/dist/components/core/dashboard/SolidDashboardFilterRequired.d.ts +0 -2
- package/dist/components/core/dashboard/SolidDashboardFilterRequired.d.ts.map +0 -1
- package/dist/components/core/dashboard/SolidDashboardFilterRequired.js +0 -11
- package/dist/components/core/dashboard/SolidDashboardFilterRequired.js.map +0 -1
- package/dist/components/core/dashboard/SolidDashboardFilterRequired.tsx +0 -28
- package/dist/components/core/dashboard/SolidDashboardHeader.d.ts +0 -3
- package/dist/components/core/dashboard/SolidDashboardHeader.d.ts.map +0 -1
- package/dist/components/core/dashboard/SolidDashboardHeader.js +0 -6
- package/dist/components/core/dashboard/SolidDashboardHeader.js.map +0 -1
- package/dist/components/core/dashboard/SolidDashboardHeader.tsx +0 -10
- package/dist/components/core/dashboard/SolidDashboardLoading.d.ts +0 -2
- package/dist/components/core/dashboard/SolidDashboardLoading.d.ts.map +0 -1
- package/dist/components/core/dashboard/SolidDashboardLoading.js +0 -10
- package/dist/components/core/dashboard/SolidDashboardLoading.js.map +0 -1
- package/dist/components/core/dashboard/SolidDashboardLoading.tsx +0 -61
- package/dist/components/core/dashboard/SolidDashboardNotAvailable.d.ts +0 -3
- package/dist/components/core/dashboard/SolidDashboardNotAvailable.d.ts.map +0 -1
- package/dist/components/core/dashboard/SolidDashboardNotAvailable.js +0 -12
- package/dist/components/core/dashboard/SolidDashboardNotAvailable.js.map +0 -1
- package/dist/components/core/dashboard/SolidDashboardNotAvailable.tsx +0 -32
- package/dist/components/core/dashboard/SolidDashboardRenderError.d.ts +0 -2
- package/dist/components/core/dashboard/SolidDashboardRenderError.d.ts.map +0 -1
- package/dist/components/core/dashboard/SolidDashboardRenderError.js +0 -11
- package/dist/components/core/dashboard/SolidDashboardRenderError.js.map +0 -1
- package/dist/components/core/dashboard/SolidDashboardRenderError.tsx +0 -28
- package/dist/components/core/dashboard/SolidDashboardVariable.d.ts +0 -19
- package/dist/components/core/dashboard/SolidDashboardVariable.d.ts.map +0 -1
- package/dist/components/core/dashboard/SolidDashboardVariable.js +0 -171
- package/dist/components/core/dashboard/SolidDashboardVariable.js.map +0 -1
- package/dist/components/core/dashboard/SolidDashboardVariable.tsx +0 -259
- package/dist/components/core/dashboard/SolidQuestionRenderer.d.ts +0 -9
- package/dist/components/core/dashboard/SolidQuestionRenderer.d.ts.map +0 -1
- package/dist/components/core/dashboard/SolidQuestionRenderer.js +0 -42
- package/dist/components/core/dashboard/SolidQuestionRenderer.js.map +0 -1
- package/dist/components/core/dashboard/SolidQuestionRenderer.tsx +0 -99
- package/dist/components/core/dashboard/chart-renderers/ChartJsRenderer.d.ts +0 -9
- package/dist/components/core/dashboard/chart-renderers/ChartJsRenderer.d.ts.map +0 -1
- package/dist/components/core/dashboard/chart-renderers/ChartJsRenderer.js +0 -35
- package/dist/components/core/dashboard/chart-renderers/ChartJsRenderer.js.map +0 -1
- package/dist/components/core/dashboard/chart-renderers/ChartJsRenderer.tsx +0 -48
- package/dist/components/core/dashboard/chart-renderers/PrimeReactDatatableRenderer.d.ts +0 -7
- package/dist/components/core/dashboard/chart-renderers/PrimeReactDatatableRenderer.d.ts.map +0 -1
- package/dist/components/core/dashboard/chart-renderers/PrimeReactDatatableRenderer.js +0 -22
- package/dist/components/core/dashboard/chart-renderers/PrimeReactDatatableRenderer.js.map +0 -1
- package/dist/components/core/dashboard/chart-renderers/PrimeReactDatatableRenderer.tsx +0 -51
- package/dist/components/core/dashboard/chart-renderers/init-chartjs.d.ts +0 -2
- package/dist/components/core/dashboard/chart-renderers/init-chartjs.d.ts.map +0 -1
- package/dist/components/core/dashboard/chart-renderers/init-chartjs.js +0 -4
- package/dist/components/core/dashboard/chart-renderers/init-chartjs.js.map +0 -1
- package/dist/components/core/dashboard/chart-renderers/init-chartjs.ts +0 -25
- package/dist/components/core/dashboard/dashboard-utils.d.ts +0 -2
- package/dist/components/core/dashboard/dashboard-utils.d.ts.map +0 -1
- package/dist/components/core/dashboard/dashboard-utils.js +0 -38
- package/dist/components/core/dashboard/dashboard-utils.js.map +0 -1
- package/dist/components/core/dashboard/dashboard-utils.ts +0 -39
- package/dist/components/core/extension/solid-core/dashboard/dashboardFormViewChangeHandler.d.ts +0 -10
- package/dist/components/core/extension/solid-core/dashboard/dashboardFormViewChangeHandler.d.ts.map +0 -1
- package/dist/components/core/extension/solid-core/dashboard/dashboardFormViewChangeHandler.js +0 -16
- package/dist/components/core/extension/solid-core/dashboard/dashboardFormViewChangeHandler.js.map +0 -1
- package/dist/components/core/extension/solid-core/dashboard/dashboardFormViewChangeHandler.ts +0 -19
- package/dist/components/core/extension/solid-core/dashboard/dashboardQuestionFieldChangeHandler.d.ts +0 -8
- package/dist/components/core/extension/solid-core/dashboard/dashboardQuestionFieldChangeHandler.d.ts.map +0 -1
- package/dist/components/core/extension/solid-core/dashboard/dashboardQuestionFieldChangeHandler.js +0 -64
- package/dist/components/core/extension/solid-core/dashboard/dashboardQuestionFieldChangeHandler.js.map +0 -1
- package/dist/components/core/extension/solid-core/dashboard/dashboardQuestionFieldChangeHandler.ts +0 -30
- package/dist/components/core/extension/solid-core/dashboard/dashboardQuestionOnFormLoadHandler.d.ts +0 -8
- package/dist/components/core/extension/solid-core/dashboard/dashboardQuestionOnFormLoadHandler.d.ts.map +0 -1
- package/dist/components/core/extension/solid-core/dashboard/dashboardQuestionOnFormLoadHandler.js +0 -62
- package/dist/components/core/extension/solid-core/dashboard/dashboardQuestionOnFormLoadHandler.js.map +0 -1
- package/dist/components/core/extension/solid-core/dashboard/dashboardQuestionOnFormLoadHandler.ts +0 -29
- package/dist/components/core/extension/solid-core/dashboardQuestion/ChartFormPreviewWidget.d.ts +0 -4
- package/dist/components/core/extension/solid-core/dashboardQuestion/ChartFormPreviewWidget.d.ts.map +0 -1
- package/dist/components/core/extension/solid-core/dashboardQuestion/ChartFormPreviewWidget.js +0 -23
- package/dist/components/core/extension/solid-core/dashboardQuestion/ChartFormPreviewWidget.js.map +0 -1
- package/dist/components/core/extension/solid-core/dashboardQuestion/ChartFormPreviewWidget.tsx +0 -36
- package/dist/components/core/form/fields/widgets/SolidChatterMessageCoModelEntityIdFormViewWidget.d.ts +0 -3
- package/dist/components/core/form/fields/widgets/SolidChatterMessageCoModelEntityIdFormViewWidget.d.ts.map +0 -1
- package/dist/components/core/form/fields/widgets/SolidChatterMessageCoModelEntityIdFormViewWidget.js +0 -92
- package/dist/components/core/form/fields/widgets/SolidChatterMessageCoModelEntityIdFormViewWidget.js.map +0 -1
- package/dist/components/core/form/fields/widgets/SolidChatterMessageCoModelEntityIdFormViewWidget.tsx +0 -68
- package/dist/components/core/form/fields/widgets/SolidLovTypeChangeFormEditWidget.d.ts +0 -3
- package/dist/components/core/form/fields/widgets/SolidLovTypeChangeFormEditWidget.d.ts.map +0 -1
- package/dist/components/core/form/fields/widgets/SolidLovTypeChangeFormEditWidget.js +0 -111
- package/dist/components/core/form/fields/widgets/SolidLovTypeChangeFormEditWidget.js.map +0 -1
- package/dist/components/core/form/fields/widgets/SolidLovTypeChangeFormEditWidget.tsx +0 -122
- package/dist/components/core/kanban/SolidKanbanViewFields.d.ts +0 -12
- package/dist/components/core/kanban/SolidKanbanViewFields.d.ts.map +0 -1
- package/dist/components/core/kanban/SolidKanbanViewFields.js +0 -145
- package/dist/components/core/kanban/SolidKanbanViewFields.js.map +0 -1
- package/dist/components/core/kanban/SolidKanbanViewFields.tsx +0 -164
- package/dist/components/core/kanban/SolidManyToOneFilterElement.d.ts +0 -2
- package/dist/components/core/kanban/SolidManyToOneFilterElement.d.ts.map +0 -1
- package/dist/components/core/kanban/SolidManyToOneFilterElement.js +0 -87
- package/dist/components/core/kanban/SolidManyToOneFilterElement.js.map +0 -1
- package/dist/components/core/kanban/SolidManyToOneFilterElement.tsx +0 -59
- package/dist/components/core/kanban/SolidSelectionDynamicFilterElement.d.ts +0 -2
- package/dist/components/core/kanban/SolidSelectionDynamicFilterElement.d.ts.map +0 -1
- package/dist/components/core/kanban/SolidSelectionDynamicFilterElement.js +0 -73
- package/dist/components/core/kanban/SolidSelectionDynamicFilterElement.js.map +0 -1
- package/dist/components/core/kanban/SolidSelectionDynamicFilterElement.tsx +0 -50
- package/dist/components/core/kanban/SolidSelectionStaticFilterElement.d.ts +0 -2
- package/dist/components/core/kanban/SolidSelectionStaticFilterElement.d.ts.map +0 -1
- package/dist/components/core/kanban/SolidSelectionStaticFilterElement.js +0 -20
- package/dist/components/core/kanban/SolidSelectionStaticFilterElement.js.map +0 -1
- package/dist/components/core/kanban/SolidSelectionStaticFilterElement.tsx +0 -32
- package/dist/components/core/kanban/SolidVarInputsFilterElement.d.ts +0 -12
- package/dist/components/core/kanban/SolidVarInputsFilterElement.d.ts.map +0 -1
- package/dist/components/core/kanban/SolidVarInputsFilterElement.js +0 -81
- package/dist/components/core/kanban/SolidVarInputsFilterElement.js.map +0 -1
- package/dist/components/core/kanban/SolidVarInputsFilterElement.tsx +0 -184
- package/dist/components/core/kanban/kanban-fields/SolidBigintKanbanField.d.ts +0 -4
- package/dist/components/core/kanban/kanban-fields/SolidBigintKanbanField.d.ts.map +0 -1
- package/dist/components/core/kanban/kanban-fields/SolidBigintKanbanField.js +0 -7
- package/dist/components/core/kanban/kanban-fields/SolidBigintKanbanField.js.map +0 -1
- package/dist/components/core/kanban/kanban-fields/SolidBigintKanbanField.tsx +0 -9
- package/dist/components/core/kanban/kanban-fields/SolidBooleanKanbanField.d.ts +0 -4
- package/dist/components/core/kanban/kanban-fields/SolidBooleanKanbanField.d.ts.map +0 -1
- package/dist/components/core/kanban/kanban-fields/SolidBooleanKanbanField.js +0 -8
- package/dist/components/core/kanban/kanban-fields/SolidBooleanKanbanField.js.map +0 -1
- package/dist/components/core/kanban/kanban-fields/SolidBooleanKanbanField.tsx +0 -16
- package/dist/components/core/kanban/kanban-fields/SolidComputedKanbanField.d.ts +0 -4
- package/dist/components/core/kanban/kanban-fields/SolidComputedKanbanField.d.ts.map +0 -1
- package/dist/components/core/kanban/kanban-fields/SolidComputedKanbanField.js +0 -21
- package/dist/components/core/kanban/kanban-fields/SolidComputedKanbanField.js.map +0 -1
- package/dist/components/core/kanban/kanban-fields/SolidComputedKanbanField.tsx +0 -23
- package/dist/components/core/kanban/kanban-fields/SolidDateKanbanField.d.ts +0 -4
- package/dist/components/core/kanban/kanban-fields/SolidDateKanbanField.d.ts.map +0 -1
- package/dist/components/core/kanban/kanban-fields/SolidDateKanbanField.js +0 -8
- package/dist/components/core/kanban/kanban-fields/SolidDateKanbanField.js.map +0 -1
- package/dist/components/core/kanban/kanban-fields/SolidDateKanbanField.tsx +0 -14
- package/dist/components/core/kanban/kanban-fields/SolidDatetimeKanbanField.d.ts +0 -4
- package/dist/components/core/kanban/kanban-fields/SolidDatetimeKanbanField.d.ts.map +0 -1
- package/dist/components/core/kanban/kanban-fields/SolidDatetimeKanbanField.js +0 -8
- package/dist/components/core/kanban/kanban-fields/SolidDatetimeKanbanField.js.map +0 -1
- package/dist/components/core/kanban/kanban-fields/SolidDatetimeKanbanField.tsx +0 -13
- package/dist/components/core/kanban/kanban-fields/SolidDecimalKanbanField.d.ts +0 -4
- package/dist/components/core/kanban/kanban-fields/SolidDecimalKanbanField.d.ts.map +0 -1
- package/dist/components/core/kanban/kanban-fields/SolidDecimalKanbanField.js +0 -7
- package/dist/components/core/kanban/kanban-fields/SolidDecimalKanbanField.js.map +0 -1
- package/dist/components/core/kanban/kanban-fields/SolidDecimalKanbanField.tsx +0 -9
- package/dist/components/core/kanban/kanban-fields/SolidExternalIdKanbanField.d.ts +0 -4
- package/dist/components/core/kanban/kanban-fields/SolidExternalIdKanbanField.d.ts.map +0 -1
- package/dist/components/core/kanban/kanban-fields/SolidExternalIdKanbanField.js +0 -8
- package/dist/components/core/kanban/kanban-fields/SolidExternalIdKanbanField.js.map +0 -1
- package/dist/components/core/kanban/kanban-fields/SolidExternalIdKanbanField.tsx +0 -12
- package/dist/components/core/kanban/kanban-fields/SolidFloatKanbanField.d.ts +0 -4
- package/dist/components/core/kanban/kanban-fields/SolidFloatKanbanField.d.ts.map +0 -1
- package/dist/components/core/kanban/kanban-fields/SolidFloatKanbanField.js +0 -7
- package/dist/components/core/kanban/kanban-fields/SolidFloatKanbanField.js.map +0 -1
- package/dist/components/core/kanban/kanban-fields/SolidFloatKanbanField.tsx +0 -9
- package/dist/components/core/kanban/kanban-fields/SolidIdKanbanField.d.ts +0 -4
- package/dist/components/core/kanban/kanban-fields/SolidIdKanbanField.d.ts.map +0 -1
- package/dist/components/core/kanban/kanban-fields/SolidIdKanbanField.js +0 -8
- package/dist/components/core/kanban/kanban-fields/SolidIdKanbanField.js.map +0 -1
- package/dist/components/core/kanban/kanban-fields/SolidIdKanbanField.tsx +0 -14
- package/dist/components/core/kanban/kanban-fields/SolidIntKanbanField.d.ts +0 -4
- package/dist/components/core/kanban/kanban-fields/SolidIntKanbanField.d.ts.map +0 -1
- package/dist/components/core/kanban/kanban-fields/SolidIntKanbanField.js +0 -16
- package/dist/components/core/kanban/kanban-fields/SolidIntKanbanField.js.map +0 -1
- package/dist/components/core/kanban/kanban-fields/SolidIntKanbanField.tsx +0 -20
- package/dist/components/core/kanban/kanban-fields/SolidLongTextKanbanField.d.ts +0 -4
- package/dist/components/core/kanban/kanban-fields/SolidLongTextKanbanField.d.ts.map +0 -1
- package/dist/components/core/kanban/kanban-fields/SolidLongTextKanbanField.js +0 -7
- package/dist/components/core/kanban/kanban-fields/SolidLongTextKanbanField.js.map +0 -1
- package/dist/components/core/kanban/kanban-fields/SolidLongTextKanbanField.tsx +0 -9
- package/dist/components/core/kanban/kanban-fields/SolidMediaMultipleKanbanField.d.ts +0 -4
- package/dist/components/core/kanban/kanban-fields/SolidMediaMultipleKanbanField.d.ts.map +0 -1
- package/dist/components/core/kanban/kanban-fields/SolidMediaMultipleKanbanField.js +0 -56
- package/dist/components/core/kanban/kanban-fields/SolidMediaMultipleKanbanField.js.map +0 -1
- package/dist/components/core/kanban/kanban-fields/SolidMediaMultipleKanbanField.tsx +0 -140
- package/dist/components/core/kanban/kanban-fields/SolidMediaSingleKanbanField.d.ts +0 -4
- package/dist/components/core/kanban/kanban-fields/SolidMediaSingleKanbanField.d.ts.map +0 -1
- package/dist/components/core/kanban/kanban-fields/SolidMediaSingleKanbanField.js +0 -42
- package/dist/components/core/kanban/kanban-fields/SolidMediaSingleKanbanField.js.map +0 -1
- package/dist/components/core/kanban/kanban-fields/SolidMediaSingleKanbanField.tsx +0 -164
- package/dist/components/core/kanban/kanban-fields/SolidRelationKanbanField.d.ts +0 -4
- package/dist/components/core/kanban/kanban-fields/SolidRelationKanbanField.d.ts.map +0 -1
- package/dist/components/core/kanban/kanban-fields/SolidRelationKanbanField.js +0 -11
- package/dist/components/core/kanban/kanban-fields/SolidRelationKanbanField.js.map +0 -1
- package/dist/components/core/kanban/kanban-fields/SolidRelationKanbanField.tsx +0 -13
- package/dist/components/core/kanban/kanban-fields/SolidRichTextKanbanField.d.ts +0 -4
- package/dist/components/core/kanban/kanban-fields/SolidRichTextKanbanField.d.ts.map +0 -1
- package/dist/components/core/kanban/kanban-fields/SolidRichTextKanbanField.js +0 -7
- package/dist/components/core/kanban/kanban-fields/SolidRichTextKanbanField.js.map +0 -1
- package/dist/components/core/kanban/kanban-fields/SolidRichTextKanbanField.tsx +0 -9
- package/dist/components/core/kanban/kanban-fields/SolidSelectionDynamicKanbanField.d.ts +0 -4
- package/dist/components/core/kanban/kanban-fields/SolidSelectionDynamicKanbanField.d.ts.map +0 -1
- package/dist/components/core/kanban/kanban-fields/SolidSelectionDynamicKanbanField.js +0 -8
- package/dist/components/core/kanban/kanban-fields/SolidSelectionDynamicKanbanField.js.map +0 -1
- package/dist/components/core/kanban/kanban-fields/SolidSelectionDynamicKanbanField.tsx +0 -14
- package/dist/components/core/kanban/kanban-fields/SolidSelectionStaticKanbanField.d.ts +0 -4
- package/dist/components/core/kanban/kanban-fields/SolidSelectionStaticKanbanField.d.ts.map +0 -1
- package/dist/components/core/kanban/kanban-fields/SolidSelectionStaticKanbanField.js +0 -8
- package/dist/components/core/kanban/kanban-fields/SolidSelectionStaticKanbanField.js.map +0 -1
- package/dist/components/core/kanban/kanban-fields/SolidSelectionStaticKanbanField.tsx +0 -14
- package/dist/components/core/kanban/kanban-fields/SolidShortTextKanbanField.d.ts +0 -4
- package/dist/components/core/kanban/kanban-fields/SolidShortTextKanbanField.d.ts.map +0 -1
- package/dist/components/core/kanban/kanban-fields/SolidShortTextKanbanField.js +0 -37
- package/dist/components/core/kanban/kanban-fields/SolidShortTextKanbanField.js.map +0 -1
- package/dist/components/core/kanban/kanban-fields/SolidShortTextKanbanField.tsx +0 -121
- package/dist/components/core/kanban/kanban-fields/SolidTimeKanbanField.d.ts +0 -4
- package/dist/components/core/kanban/kanban-fields/SolidTimeKanbanField.d.ts.map +0 -1
- package/dist/components/core/kanban/kanban-fields/SolidTimeKanbanField.js +0 -8
- package/dist/components/core/kanban/kanban-fields/SolidTimeKanbanField.js.map +0 -1
- package/dist/components/core/kanban/kanban-fields/SolidTimeKanbanField.tsx +0 -12
- package/dist/components/core/kanban/kanban-fields/SolidUuidKanbanField.d.ts +0 -4
- package/dist/components/core/kanban/kanban-fields/SolidUuidKanbanField.d.ts.map +0 -1
- package/dist/components/core/kanban/kanban-fields/SolidUuidKanbanField.js +0 -8
- package/dist/components/core/kanban/kanban-fields/SolidUuidKanbanField.js.map +0 -1
- package/dist/components/core/kanban/kanban-fields/SolidUuidKanbanField.tsx +0 -13
- package/dist/components/core/kanban/kanban-fields/relations/SolidRelationManyToOneKanbanField.d.ts +0 -4
- package/dist/components/core/kanban/kanban-fields/relations/SolidRelationManyToOneKanbanField.d.ts.map +0 -1
- package/dist/components/core/kanban/kanban-fields/relations/SolidRelationManyToOneKanbanField.js +0 -7
- package/dist/components/core/kanban/kanban-fields/relations/SolidRelationManyToOneKanbanField.js.map +0 -1
- package/dist/components/core/kanban/kanban-fields/relations/SolidRelationManyToOneKanbanField.tsx +0 -16
- package/dist/components/core/list/SolidListViewRowButtonContextMenu.d.ts +0 -2
- package/dist/components/core/list/SolidListViewRowButtonContextMenu.d.ts.map +0 -1
- package/dist/components/core/list/SolidListViewRowButtonContextMenu.js +0 -39
- package/dist/components/core/list/SolidListViewRowButtonContextMenu.js.map +0 -1
- package/dist/components/core/list/SolidListViewRowButtonContextMenu.tsx +0 -40
- package/dist/components/core/list/SolidVarInputsFilterElement.d.ts +0 -12
- package/dist/components/core/list/SolidVarInputsFilterElement.d.ts.map +0 -1
- package/dist/components/core/list/SolidVarInputsFilterElement.js +0 -81
- package/dist/components/core/list/SolidVarInputsFilterElement.js.map +0 -1
- package/dist/components/core/list/SolidVarInputsFilterElement.tsx +0 -184
- package/dist/components/core/list/widgets/SolidChatterMessageCoModelEntityIdListViewWidget.d.ts +0 -3
- package/dist/components/core/list/widgets/SolidChatterMessageCoModelEntityIdListViewWidget.d.ts.map +0 -1
- package/dist/components/core/list/widgets/SolidChatterMessageCoModelEntityIdListViewWidget.js +0 -87
- package/dist/components/core/list/widgets/SolidChatterMessageCoModelEntityIdListViewWidget.js.map +0 -1
- package/dist/components/core/list/widgets/SolidChatterMessageCoModelEntityIdListViewWidget.tsx +0 -70
- package/dist/components/core/list/widgets/SolidMqMessageStageListViewWidget.d.ts +0 -3
- package/dist/components/core/list/widgets/SolidMqMessageStageListViewWidget.d.ts.map +0 -1
- package/dist/components/core/list/widgets/SolidMqMessageStageListViewWidget.js +0 -33
- package/dist/components/core/list/widgets/SolidMqMessageStageListViewWidget.js.map +0 -1
- package/dist/components/core/list/widgets/SolidMqMessageStageListViewWidget.tsx +0 -50
- package/dist/components/core/list/widgets/SolidSummarizeListHeaderActionMqMessages.d.ts +0 -3
- package/dist/components/core/list/widgets/SolidSummarizeListHeaderActionMqMessages.d.ts.map +0 -1
- package/dist/components/core/list/widgets/SolidSummarizeListHeaderActionMqMessages.js +0 -158
- package/dist/components/core/list/widgets/SolidSummarizeListHeaderActionMqMessages.js.map +0 -1
- package/dist/components/core/list/widgets/SolidSummarizeListHeaderActionMqMessages.tsx +0 -185
- package/dist/components/layout/DashboardHeader.d.ts +0 -3
- package/dist/components/layout/DashboardHeader.d.ts.map +0 -1
- package/dist/components/layout/DashboardHeader.js +0 -20
- package/dist/components/layout/DashboardHeader.js.map +0 -1
- package/dist/components/layout/DashboardHeader.tsx +0 -94
- package/dist/helpers/# no such endpoints exist, need to calle +0 -3
- package/dist/helpers/ToastContainer.d.ts +0 -4
- package/dist/helpers/ToastContainer.d.ts.map +0 -1
- package/dist/helpers/ToastContainer.js +0 -49
- package/dist/helpers/ToastContainer.js.map +0 -1
- package/dist/helpers/ToastContainer.tsx +0 -94
- package/dist/helpers/showToast.d.ts +0 -5
- package/dist/helpers/showToast.d.ts.map +0 -1
- package/dist/helpers/showToast.js +0 -17
- package/dist/helpers/showToast.js.map +0 -1
- package/dist/helpers/showToast.ts +0 -13
- package/dist/helpers/studioSandbox.d.ts +0 -31
- package/dist/helpers/studioSandbox.d.ts.map +0 -1
- package/dist/helpers/studioSandbox.js +0 -104
- package/dist/helpers/studioSandbox.js.map +0 -1
- package/dist/helpers/studioSandbox.ts +0 -117
- package/dist/nextAuth/authProviders.d.ts +0 -4
- package/dist/nextAuth/authProviders.d.ts.map +0 -1
- package/dist/nextAuth/authProviders.js +0 -198
- package/dist/nextAuth/authProviders.js.map +0 -1
- package/dist/nextAuth/authProviders.tsx +0 -232
- package/dist/nextAuth/handleLogout.d.ts +0 -2
- package/dist/nextAuth/handleLogout.d.ts.map +0 -1
- package/dist/nextAuth/handleLogout.js +0 -36
- package/dist/nextAuth/handleLogout.js.map +0 -1
- package/dist/nextAuth/handleLogout.tsx +0 -39
- package/dist/nextAuth/refreshAccessToken.d.ts +0 -2
- package/dist/nextAuth/refreshAccessToken.d.ts.map +0 -1
- package/dist/nextAuth/refreshAccessToken.js +0 -24
- package/dist/nextAuth/refreshAccessToken.js.map +0 -1
- package/dist/nextAuth/refreshAccessToken.tsx +0 -28
- package/dist/redux/api/dashboardApi.d.ts +0 -23
- package/dist/redux/api/dashboardApi.d.ts.map +0 -1
- package/dist/redux/api/dashboardApi.js +0 -35
- package/dist/redux/api/dashboardApi.js.map +0 -1
- package/dist/redux/api/dashboardApi.ts +0 -56
- package/dist/redux/api/dashboardLayoutApi.d.ts +0 -24
- package/dist/redux/api/dashboardLayoutApi.d.ts.map +0 -1
- package/dist/redux/api/dashboardLayoutApi.js +0 -34
- package/dist/redux/api/dashboardLayoutApi.js.map +0 -1
- package/dist/redux/api/dashboardLayoutApi.ts +0 -55
- package/dist/redux/api/dashboardQuestionApi.d.ts +0 -5
- package/dist/redux/api/dashboardQuestionApi.d.ts.map +0 -1
- package/dist/redux/api/dashboardQuestionApi.js +0 -18
- package/dist/redux/api/dashboardQuestionApi.js.map +0 -1
- package/dist/redux/api/dashboardQuestionApi.ts +0 -17
- package/dist/redux/features/settingsSlice.d.ts +0 -20
- package/dist/redux/features/settingsSlice.d.ts.map +0 -1
- package/dist/redux/features/settingsSlice.js +0 -39
- package/dist/redux/features/settingsSlice.js.map +0 -1
- package/dist/redux/features/settingsSlice.ts +0 -60
- package/dist/resources/images/Footerbg.png +0 -0
- package/dist/resources/images/LoginBanner.png +0 -0
- package/dist/resources/images/dashboard/Ellipse 1.svg +0 -10
- package/dist/resources/images/dashboard/Rectangle 17.svg +0 -10
- package/dist/resources/images/dashboard/Rectangle 25.svg +0 -11
- package/dist/resources/images/dashboard/image 5.svg +0 -9
- package/dist/resources/images/loginhero.png +0 -0
- package/dist/resources/images/logo.png +0 -0
- package/dist/resources/images/radix-logo-white.png +0 -0
- package/dist/resources/images/radix-logo.png +0 -0
- package/dist/resources/images/signupBanner.png +0 -0
|
@@ -0,0 +1,1274 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {
|
|
3
|
+
Background,
|
|
4
|
+
BackgroundVariant,
|
|
5
|
+
Controls,
|
|
6
|
+
type Edge,
|
|
7
|
+
Handle,
|
|
8
|
+
MarkerType,
|
|
9
|
+
MiniMap,
|
|
10
|
+
type Node,
|
|
11
|
+
Position,
|
|
12
|
+
ReactFlow,
|
|
13
|
+
ReactFlowProvider,
|
|
14
|
+
} from "@xyflow/react";
|
|
15
|
+
import { BookOpen, CircleHelp, Pencil, Plus, Trash2 } from "lucide-react";
|
|
16
|
+
import type {
|
|
17
|
+
WorkflowNodeChildSlotDefinition,
|
|
18
|
+
WorkflowNodeMetadataResponse,
|
|
19
|
+
} from "../../types/workflow-node";
|
|
20
|
+
import { normalizeSolidIconName, SolidButton, SolidIcon, SolidTag } from "../shad-cn-ui";
|
|
21
|
+
import "@xyflow/react/dist/style.css";
|
|
22
|
+
import "./WorkflowFlowCanvas.css";
|
|
23
|
+
|
|
24
|
+
type WorkflowNodeRecord = Record<string, any>;
|
|
25
|
+
type WorkflowTriggerRecord = Record<string, any>;
|
|
26
|
+
|
|
27
|
+
type WorkflowInsertScope =
|
|
28
|
+
| { scope: "root" }
|
|
29
|
+
| {
|
|
30
|
+
scope: "slot";
|
|
31
|
+
parentNodeId: string;
|
|
32
|
+
slotKey: "children" | "nodes" | "then" | "else";
|
|
33
|
+
}
|
|
34
|
+
| {
|
|
35
|
+
scope: "branch";
|
|
36
|
+
parentNodeId: string;
|
|
37
|
+
branchId: string;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export type WorkflowInsertTarget =
|
|
41
|
+
| {
|
|
42
|
+
scope: "root";
|
|
43
|
+
index: number;
|
|
44
|
+
}
|
|
45
|
+
| {
|
|
46
|
+
scope: "slot";
|
|
47
|
+
parentNodeId: string;
|
|
48
|
+
slotKey: "children" | "nodes" | "then" | "else";
|
|
49
|
+
index: number;
|
|
50
|
+
}
|
|
51
|
+
| {
|
|
52
|
+
scope: "branch";
|
|
53
|
+
parentNodeId: string;
|
|
54
|
+
branchId: string;
|
|
55
|
+
index: number;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
type WorkflowCanvasNodeData =
|
|
59
|
+
| {
|
|
60
|
+
kind: "group";
|
|
61
|
+
label: string;
|
|
62
|
+
tone?: "control" | "loop" | "trigger";
|
|
63
|
+
workflowNode?: WorkflowNodeRecord;
|
|
64
|
+
nodeType?: WorkflowNodeMetadataResponse;
|
|
65
|
+
onViewDocs?: (nodeId: string) => void;
|
|
66
|
+
}
|
|
67
|
+
| {
|
|
68
|
+
kind: "workflow-node";
|
|
69
|
+
workflowNode: WorkflowNodeRecord;
|
|
70
|
+
nodeType?: WorkflowNodeMetadataResponse;
|
|
71
|
+
selected?: boolean;
|
|
72
|
+
readOnly?: boolean;
|
|
73
|
+
onSelectNode: (nodeId: string) => void;
|
|
74
|
+
onEditNode: (nodeId: string) => void;
|
|
75
|
+
onDeleteNode: (nodeId: string) => void;
|
|
76
|
+
onViewDocs: (nodeId: string) => void;
|
|
77
|
+
}
|
|
78
|
+
| {
|
|
79
|
+
kind: "workflow-trigger";
|
|
80
|
+
trigger: WorkflowTriggerRecord;
|
|
81
|
+
selected?: boolean;
|
|
82
|
+
readOnly?: boolean;
|
|
83
|
+
onSelectTrigger: (triggerId: string) => void;
|
|
84
|
+
onViewDocs: (triggerId: string) => void;
|
|
85
|
+
}
|
|
86
|
+
| {
|
|
87
|
+
kind: "insert";
|
|
88
|
+
enabled?: boolean;
|
|
89
|
+
selectedTypeLabel?: string;
|
|
90
|
+
onInsert: () => void;
|
|
91
|
+
}
|
|
92
|
+
| {
|
|
93
|
+
kind: "section-label";
|
|
94
|
+
label: string;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
type WorkflowFlowCanvasProps = {
|
|
98
|
+
definition: { nodes: WorkflowNodeRecord[]; triggers?: WorkflowTriggerRecord[] };
|
|
99
|
+
nodeTypes: WorkflowNodeMetadataResponse[];
|
|
100
|
+
selectedNodeId?: string;
|
|
101
|
+
selectedTriggerId?: string;
|
|
102
|
+
activePaletteNodeType?: WorkflowNodeMetadataResponse;
|
|
103
|
+
onSelectNode: (nodeId: string) => void;
|
|
104
|
+
onSelectTrigger: (triggerId: string) => void;
|
|
105
|
+
onEditNode: (nodeId: string) => void;
|
|
106
|
+
onDeleteNode: (nodeId: string) => void;
|
|
107
|
+
onViewDocs: (nodeId: string) => void;
|
|
108
|
+
onViewTriggerDocs: (triggerId: string) => void;
|
|
109
|
+
onInsertNode: (target: WorkflowInsertTarget) => void;
|
|
110
|
+
onAddBranch: (parentNodeId: string) => void;
|
|
111
|
+
readOnly?: boolean;
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
const DIMENSIONS = {
|
|
115
|
+
workflowWidth: 248,
|
|
116
|
+
workflowHeight: 118,
|
|
117
|
+
triggerWidth: 248,
|
|
118
|
+
triggerHeight: 108,
|
|
119
|
+
insertWidth: 160,
|
|
120
|
+
insertHeight: 40,
|
|
121
|
+
sectionLabelWidth: 104,
|
|
122
|
+
sectionLabelHeight: 28,
|
|
123
|
+
groupPaddingX: 28,
|
|
124
|
+
groupPaddingTop: 42,
|
|
125
|
+
groupPaddingBottom: 22,
|
|
126
|
+
loopGroupPaddingX: 70,
|
|
127
|
+
loopGroupPaddingTop: 46,
|
|
128
|
+
loopGroupPaddingBottom: 34,
|
|
129
|
+
controlChildLabelOffsetY: 138,
|
|
130
|
+
controlChildStartOffsetY: 150,
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
type WorkflowLayoutResult = {
|
|
134
|
+
entryId: string;
|
|
135
|
+
exitId: string;
|
|
136
|
+
endY: number;
|
|
137
|
+
width: number;
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
type GraphBuildContext = {
|
|
141
|
+
backgroundNodes: Node<WorkflowCanvasNodeData>[];
|
|
142
|
+
nodes: Node<WorkflowCanvasNodeData>[];
|
|
143
|
+
edges: Edge[];
|
|
144
|
+
nodeTypeMap: Map<string, WorkflowNodeMetadataResponse>;
|
|
145
|
+
readOnly?: boolean;
|
|
146
|
+
activePaletteNodeType?: WorkflowNodeMetadataResponse;
|
|
147
|
+
selectedNodeId?: string;
|
|
148
|
+
selectedTriggerId?: string;
|
|
149
|
+
onSelectNode: (nodeId: string) => void;
|
|
150
|
+
onSelectTrigger: (triggerId: string) => void;
|
|
151
|
+
onEditNode: (nodeId: string) => void;
|
|
152
|
+
onDeleteNode: (nodeId: string) => void;
|
|
153
|
+
onViewDocs: (nodeId: string) => void;
|
|
154
|
+
onViewTriggerDocs: (triggerId: string) => void;
|
|
155
|
+
onInsertNode: (target: WorkflowInsertTarget) => void;
|
|
156
|
+
onAddBranch: (parentNodeId: string) => void;
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
function normalizeChildSlots(
|
|
160
|
+
node: WorkflowNodeRecord,
|
|
161
|
+
nodeType?: WorkflowNodeMetadataResponse,
|
|
162
|
+
): WorkflowNodeChildSlotDefinition[] {
|
|
163
|
+
if (nodeType?.authoring?.childSlots?.length) {
|
|
164
|
+
return nodeType.authoring.childSlots;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
const slots: WorkflowNodeChildSlotDefinition[] = [];
|
|
168
|
+
if (Array.isArray(node.then) || Array.isArray(node.else)) {
|
|
169
|
+
slots.push({ key: "then", label: "Then", kind: "sequence" });
|
|
170
|
+
slots.push({ key: "else", label: "Else", kind: "sequence" });
|
|
171
|
+
} else if (Array.isArray(node.branches)) {
|
|
172
|
+
slots.push({ key: "branches", label: "Branches", kind: "branch-collection" });
|
|
173
|
+
} else if (Array.isArray(node.children) || Array.isArray(node.nodes)) {
|
|
174
|
+
slots.push({ key: "children", label: "Children", kind: "sequence" });
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
return slots;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function isLoopNode(
|
|
181
|
+
workflowNode: WorkflowNodeRecord,
|
|
182
|
+
nodeType?: WorkflowNodeMetadataResponse,
|
|
183
|
+
) {
|
|
184
|
+
const nodeTypeId = String(workflowNode.type ?? nodeType?.type ?? "").toLowerCase();
|
|
185
|
+
const category = String(nodeType?.category ?? "").toLowerCase();
|
|
186
|
+
const nodeTypeTags = nodeType?.tags;
|
|
187
|
+
const tags = Array.isArray(nodeTypeTags)
|
|
188
|
+
? nodeTypeTags.map((tag) => String(tag).toLowerCase())
|
|
189
|
+
: [];
|
|
190
|
+
|
|
191
|
+
return (
|
|
192
|
+
nodeTypeId === "foreach" ||
|
|
193
|
+
nodeTypeId === "for.each" ||
|
|
194
|
+
nodeTypeId === "loopuntil" ||
|
|
195
|
+
nodeTypeId === "loop.until" ||
|
|
196
|
+
category.includes("loop") ||
|
|
197
|
+
tags.includes("loop") ||
|
|
198
|
+
tags.includes("iteration")
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
function getNodeRect(node: Node<WorkflowCanvasNodeData>) {
|
|
203
|
+
const width =
|
|
204
|
+
node.type === "workflow"
|
|
205
|
+
? DIMENSIONS.workflowWidth
|
|
206
|
+
: node.type === "trigger"
|
|
207
|
+
? DIMENSIONS.triggerWidth
|
|
208
|
+
: node.type === "insert"
|
|
209
|
+
? DIMENSIONS.insertWidth
|
|
210
|
+
: node.type === "sectionLabel"
|
|
211
|
+
? DIMENSIONS.sectionLabelWidth
|
|
212
|
+
: Number(node.style?.width ?? 0);
|
|
213
|
+
|
|
214
|
+
const height =
|
|
215
|
+
node.type === "workflow"
|
|
216
|
+
? DIMENSIONS.workflowHeight
|
|
217
|
+
: node.type === "trigger"
|
|
218
|
+
? DIMENSIONS.triggerHeight
|
|
219
|
+
: node.type === "insert"
|
|
220
|
+
? DIMENSIONS.insertHeight
|
|
221
|
+
: node.type === "sectionLabel"
|
|
222
|
+
? DIMENSIONS.sectionLabelHeight
|
|
223
|
+
: Number(node.style?.height ?? 0);
|
|
224
|
+
|
|
225
|
+
return {
|
|
226
|
+
left: node.position.x,
|
|
227
|
+
top: node.position.y,
|
|
228
|
+
right: node.position.x + width,
|
|
229
|
+
bottom: node.position.y + height,
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function createEdge(source: string, target: string): Edge {
|
|
234
|
+
return {
|
|
235
|
+
id: `${source}->${target}`,
|
|
236
|
+
source,
|
|
237
|
+
target,
|
|
238
|
+
type: "smoothstep",
|
|
239
|
+
markerEnd: { type: MarkerType.ArrowClosed, width: 14, height: 14 },
|
|
240
|
+
style: {
|
|
241
|
+
stroke: "rgba(191, 219, 254, 0.88)",
|
|
242
|
+
strokeWidth: 2,
|
|
243
|
+
strokeDasharray: "5 5",
|
|
244
|
+
},
|
|
245
|
+
zIndex: 2,
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
function resolveWorkflowNodeIcon(nodeType?: WorkflowNodeMetadataResponse) {
|
|
250
|
+
return normalizeSolidIconName(nodeType?.ui?.icon ?? nodeType?.icon) ?? "si-th-large";
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
function estimateSequenceWidth(
|
|
254
|
+
sequence: WorkflowNodeRecord[],
|
|
255
|
+
nodeTypeMap: Map<string, WorkflowNodeMetadataResponse>,
|
|
256
|
+
): number {
|
|
257
|
+
if (!sequence.length) {
|
|
258
|
+
return DIMENSIONS.insertWidth;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
return sequence.reduce((maxWidth, workflowNode) => {
|
|
262
|
+
const nodeType = nodeTypeMap.get(String(workflowNode.type));
|
|
263
|
+
const nodeWidth = estimateWorkflowNodeWidth(workflowNode, nodeTypeMap, nodeType);
|
|
264
|
+
return Math.max(maxWidth, nodeWidth);
|
|
265
|
+
}, DIMENSIONS.workflowWidth);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
function estimateWorkflowNodeWidth(
|
|
269
|
+
workflowNode: WorkflowNodeRecord,
|
|
270
|
+
nodeTypeMap: Map<string, WorkflowNodeMetadataResponse>,
|
|
271
|
+
nodeType?: WorkflowNodeMetadataResponse,
|
|
272
|
+
): number {
|
|
273
|
+
const slotDefinitions = normalizeChildSlots(workflowNode, nodeType);
|
|
274
|
+
|
|
275
|
+
const branchSlots = slotDefinitions.filter(
|
|
276
|
+
(slot) => slot.key === "then" || slot.key === "else",
|
|
277
|
+
);
|
|
278
|
+
if (branchSlots.length >= 2) {
|
|
279
|
+
const branchGap = 60;
|
|
280
|
+
const branchWidths = branchSlots.map((slot) =>
|
|
281
|
+
estimateSequenceWidth(
|
|
282
|
+
Array.isArray(workflowNode[slot.key]) ? workflowNode[slot.key] : [],
|
|
283
|
+
nodeTypeMap,
|
|
284
|
+
),
|
|
285
|
+
);
|
|
286
|
+
const totalBranchWidth =
|
|
287
|
+
branchWidths.reduce((sum, width) => sum + width, 0) +
|
|
288
|
+
branchGap * Math.max(branchWidths.length - 1, 0);
|
|
289
|
+
return Math.max(DIMENSIONS.workflowWidth, totalBranchWidth);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
if (slotDefinitions.length === 1 && slotDefinitions[0].kind === "sequence") {
|
|
293
|
+
const slotKey = slotDefinitions[0].key as "children" | "nodes" | "then" | "else";
|
|
294
|
+
return Math.max(
|
|
295
|
+
DIMENSIONS.workflowWidth,
|
|
296
|
+
estimateSequenceWidth(
|
|
297
|
+
Array.isArray(workflowNode[slotKey]) ? workflowNode[slotKey] : [],
|
|
298
|
+
nodeTypeMap,
|
|
299
|
+
),
|
|
300
|
+
);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
if (slotDefinitions.length === 1 && slotDefinitions[0].kind === "branch-collection") {
|
|
304
|
+
const branchGap = 56;
|
|
305
|
+
const branches = Array.isArray(workflowNode.branches) ? workflowNode.branches : [];
|
|
306
|
+
const branchWidths = branches.map((branch: any) =>
|
|
307
|
+
estimateSequenceWidth(Array.isArray(branch.nodes) ? branch.nodes : [], nodeTypeMap),
|
|
308
|
+
);
|
|
309
|
+
const totalBranchWidth =
|
|
310
|
+
branchWidths.reduce((sum, width) => sum + width, 0) +
|
|
311
|
+
branchGap * Math.max(branchWidths.length - 1, 0);
|
|
312
|
+
return Math.max(DIMENSIONS.workflowWidth, totalBranchWidth);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
return DIMENSIONS.workflowWidth;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
function WorkflowCanvasNodeRenderer({ data }: { data: WorkflowCanvasNodeData }) {
|
|
319
|
+
if (data.kind === "group") {
|
|
320
|
+
return (
|
|
321
|
+
<div
|
|
322
|
+
className={`workflow-flow-group-node workflow-flow-group-node--${data.tone ?? "control"}`}
|
|
323
|
+
>
|
|
324
|
+
<div className="workflow-flow-group-node__header">
|
|
325
|
+
<span>{data.label}</span>
|
|
326
|
+
{data.workflowNode ? (
|
|
327
|
+
<button
|
|
328
|
+
type="button"
|
|
329
|
+
className="workflow-flow-help-button nodrag nopan nowheel"
|
|
330
|
+
aria-label={`Open ${data.nodeType?.label ?? data.label} documentation`}
|
|
331
|
+
title="Documentation"
|
|
332
|
+
onPointerDown={(event) => {
|
|
333
|
+
event.stopPropagation();
|
|
334
|
+
}}
|
|
335
|
+
onClick={(event) => {
|
|
336
|
+
event.stopPropagation();
|
|
337
|
+
data.onViewDocs?.(String(data.workflowNode?.id));
|
|
338
|
+
}}
|
|
339
|
+
>
|
|
340
|
+
<CircleHelp size={12} />
|
|
341
|
+
</button>
|
|
342
|
+
) : null}
|
|
343
|
+
</div>
|
|
344
|
+
</div>
|
|
345
|
+
);
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
if (data.kind === "insert") {
|
|
349
|
+
return (
|
|
350
|
+
<div className="workflow-flow-insert-node">
|
|
351
|
+
<button
|
|
352
|
+
type="button"
|
|
353
|
+
onClick={data.onInsert}
|
|
354
|
+
className="workflow-flow-insert-node__button"
|
|
355
|
+
>
|
|
356
|
+
<Plus size={16} />
|
|
357
|
+
</button>
|
|
358
|
+
<div className="workflow-flow-insert-node__label">
|
|
359
|
+
{data.enabled
|
|
360
|
+
? `Add ${data.selectedTypeLabel ?? "node"}`
|
|
361
|
+
: "Pick a node type to insert"}
|
|
362
|
+
</div>
|
|
363
|
+
</div>
|
|
364
|
+
);
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
if (data.kind === "section-label") {
|
|
368
|
+
return <div className="workflow-flow-section-label">{data.label}</div>;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
if (data.kind === "workflow-trigger") {
|
|
372
|
+
const triggerTitle = data.readOnly
|
|
373
|
+
? String(data.trigger.id)
|
|
374
|
+
: data.trigger.name ?? data.trigger.label ?? data.trigger.id;
|
|
375
|
+
|
|
376
|
+
return (
|
|
377
|
+
<div
|
|
378
|
+
className={`workflow-flow-node-card workflow-flow-node-card--trigger ${data.selected ? "is-selected" : ""} ${data.readOnly ? "is-readonly workflow-flow-node-card--readonly-compact" : ""}`}
|
|
379
|
+
onClick={() => data.onSelectTrigger(String(data.trigger.id))}
|
|
380
|
+
role="button"
|
|
381
|
+
tabIndex={0}
|
|
382
|
+
onKeyDown={(event) => {
|
|
383
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
384
|
+
event.preventDefault();
|
|
385
|
+
data.onSelectTrigger(String(data.trigger.id));
|
|
386
|
+
}
|
|
387
|
+
}}
|
|
388
|
+
>
|
|
389
|
+
<div className="workflow-flow-node-card__header">
|
|
390
|
+
<div className="workflow-flow-node-card__header-main">
|
|
391
|
+
<div className="workflow-flow-node-card__icon-shell">
|
|
392
|
+
<SolidIcon name="si-calendar" size={16} aria-hidden />
|
|
393
|
+
</div>
|
|
394
|
+
<div>
|
|
395
|
+
<div className="workflow-flow-node-card__title">
|
|
396
|
+
{triggerTitle}
|
|
397
|
+
</div>
|
|
398
|
+
{!data.readOnly ? (
|
|
399
|
+
<div className="workflow-flow-node-card__subtitle">
|
|
400
|
+
{data.trigger.type ?? "Trigger"}
|
|
401
|
+
</div>
|
|
402
|
+
) : null}
|
|
403
|
+
</div>
|
|
404
|
+
</div>
|
|
405
|
+
{!data.readOnly ? (
|
|
406
|
+
<div className="workflow-flow-node-card__tags">
|
|
407
|
+
{data.trigger.disabled ? <SolidTag tone="warn">disabled</SolidTag> : <SolidTag>trigger</SolidTag>}
|
|
408
|
+
</div>
|
|
409
|
+
) : null}
|
|
410
|
+
</div>
|
|
411
|
+
{!data.readOnly && data.trigger.description ? (
|
|
412
|
+
<div className="workflow-flow-node-card__description">
|
|
413
|
+
{data.trigger.description}
|
|
414
|
+
</div>
|
|
415
|
+
) : null}
|
|
416
|
+
{!data.readOnly ? (
|
|
417
|
+
<div className="workflow-flow-node-card__actions">
|
|
418
|
+
<SolidButton
|
|
419
|
+
size="small"
|
|
420
|
+
variant="ghost"
|
|
421
|
+
onClick={(event) => {
|
|
422
|
+
event.stopPropagation();
|
|
423
|
+
data.onViewDocs(String(data.trigger.id));
|
|
424
|
+
}}
|
|
425
|
+
>
|
|
426
|
+
<BookOpen size={14} />
|
|
427
|
+
</SolidButton>
|
|
428
|
+
</div>
|
|
429
|
+
) : null}
|
|
430
|
+
<Handle
|
|
431
|
+
type="target"
|
|
432
|
+
position={Position.Top}
|
|
433
|
+
className="workflow-flow-node-card__handle workflow-flow-node-card__handle--top"
|
|
434
|
+
isConnectable={false}
|
|
435
|
+
/>
|
|
436
|
+
<Handle
|
|
437
|
+
type="source"
|
|
438
|
+
position={Position.Bottom}
|
|
439
|
+
className="workflow-flow-node-card__handle workflow-flow-node-card__handle--bottom"
|
|
440
|
+
isConnectable={false}
|
|
441
|
+
/>
|
|
442
|
+
</div>
|
|
443
|
+
);
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
const { workflowNode, nodeType, selected } = data;
|
|
447
|
+
const iconName = resolveWorkflowNodeIcon(nodeType);
|
|
448
|
+
const nodeTitle = data.readOnly ? String(workflowNode.id) : workflowNode.name ?? workflowNode.id;
|
|
449
|
+
const nodeTypeLabel = nodeType?.label ?? workflowNode.type ?? workflowNode.kind ?? "node";
|
|
450
|
+
|
|
451
|
+
return (
|
|
452
|
+
<div
|
|
453
|
+
className={`workflow-flow-node-card ${selected ? "is-selected" : ""} ${data.readOnly ? "is-readonly workflow-flow-node-card--readonly-compact" : ""}`}
|
|
454
|
+
onClick={() => data.onSelectNode(String(workflowNode.id))}
|
|
455
|
+
role="button"
|
|
456
|
+
tabIndex={0}
|
|
457
|
+
onKeyDown={(event) => {
|
|
458
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
459
|
+
event.preventDefault();
|
|
460
|
+
data.onSelectNode(String(workflowNode.id));
|
|
461
|
+
}
|
|
462
|
+
}}
|
|
463
|
+
>
|
|
464
|
+
<div className="workflow-flow-node-card__typebar">
|
|
465
|
+
<span>{nodeTypeLabel}</span>
|
|
466
|
+
<span className="workflow-flow-node-card__quick-actions">
|
|
467
|
+
{!data.readOnly ? (
|
|
468
|
+
<>
|
|
469
|
+
<button
|
|
470
|
+
type="button"
|
|
471
|
+
className="workflow-flow-icon-button nodrag nopan nowheel"
|
|
472
|
+
aria-label={`Edit ${nodeTitle}`}
|
|
473
|
+
title="Edit"
|
|
474
|
+
onPointerDown={(event) => {
|
|
475
|
+
event.stopPropagation();
|
|
476
|
+
}}
|
|
477
|
+
onClick={(event) => {
|
|
478
|
+
event.stopPropagation();
|
|
479
|
+
data.onEditNode(String(workflowNode.id));
|
|
480
|
+
}}
|
|
481
|
+
>
|
|
482
|
+
<Pencil size={12} />
|
|
483
|
+
</button>
|
|
484
|
+
<button
|
|
485
|
+
type="button"
|
|
486
|
+
className="workflow-flow-icon-button workflow-flow-icon-button--danger nodrag nopan nowheel"
|
|
487
|
+
aria-label={`Delete ${nodeTitle}`}
|
|
488
|
+
title="Delete"
|
|
489
|
+
onPointerDown={(event) => {
|
|
490
|
+
event.stopPropagation();
|
|
491
|
+
}}
|
|
492
|
+
onClick={(event) => {
|
|
493
|
+
event.stopPropagation();
|
|
494
|
+
data.onDeleteNode(String(workflowNode.id));
|
|
495
|
+
}}
|
|
496
|
+
>
|
|
497
|
+
<Trash2 size={12} />
|
|
498
|
+
</button>
|
|
499
|
+
</>
|
|
500
|
+
) : null}
|
|
501
|
+
<button
|
|
502
|
+
type="button"
|
|
503
|
+
className="workflow-flow-icon-button nodrag nopan nowheel"
|
|
504
|
+
aria-label={`Open ${nodeTypeLabel} documentation`}
|
|
505
|
+
title="Documentation"
|
|
506
|
+
onPointerDown={(event) => {
|
|
507
|
+
event.stopPropagation();
|
|
508
|
+
}}
|
|
509
|
+
onClick={(event) => {
|
|
510
|
+
event.stopPropagation();
|
|
511
|
+
data.onViewDocs(String(workflowNode.id));
|
|
512
|
+
}}
|
|
513
|
+
>
|
|
514
|
+
<CircleHelp size={12} />
|
|
515
|
+
</button>
|
|
516
|
+
</span>
|
|
517
|
+
</div>
|
|
518
|
+
<div className="workflow-flow-node-card__body">
|
|
519
|
+
<div className="workflow-flow-node-card__header-main">
|
|
520
|
+
<div className="workflow-flow-node-card__icon-shell">
|
|
521
|
+
<SolidIcon name={iconName} size={16} aria-hidden />
|
|
522
|
+
</div>
|
|
523
|
+
<div>
|
|
524
|
+
<div className="workflow-flow-node-card__title">
|
|
525
|
+
{nodeTitle}
|
|
526
|
+
</div>
|
|
527
|
+
</div>
|
|
528
|
+
</div>
|
|
529
|
+
</div>
|
|
530
|
+
|
|
531
|
+
{!data.readOnly && workflowNode.description ? (
|
|
532
|
+
<div className="workflow-flow-node-card__description">
|
|
533
|
+
{workflowNode.description}
|
|
534
|
+
</div>
|
|
535
|
+
) : null}
|
|
536
|
+
|
|
537
|
+
<Handle
|
|
538
|
+
type="target"
|
|
539
|
+
position={Position.Top}
|
|
540
|
+
className="workflow-flow-node-card__handle workflow-flow-node-card__handle--top"
|
|
541
|
+
isConnectable={false}
|
|
542
|
+
/>
|
|
543
|
+
<Handle
|
|
544
|
+
type="source"
|
|
545
|
+
position={Position.Bottom}
|
|
546
|
+
className="workflow-flow-node-card__handle workflow-flow-node-card__handle--bottom"
|
|
547
|
+
isConnectable={false}
|
|
548
|
+
/>
|
|
549
|
+
</div>
|
|
550
|
+
);
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
const canvasNodeTypes: any = {
|
|
554
|
+
group: WorkflowCanvasNodeRenderer,
|
|
555
|
+
workflow: WorkflowCanvasNodeRenderer,
|
|
556
|
+
trigger: WorkflowCanvasNodeRenderer,
|
|
557
|
+
insert: WorkflowCanvasNodeRenderer,
|
|
558
|
+
sectionLabel: WorkflowCanvasNodeRenderer,
|
|
559
|
+
};
|
|
560
|
+
|
|
561
|
+
function pushGroupNode(
|
|
562
|
+
ctx: GraphBuildContext,
|
|
563
|
+
id: string,
|
|
564
|
+
label: string,
|
|
565
|
+
tone: "control" | "loop" | "trigger",
|
|
566
|
+
subset: Node<WorkflowCanvasNodeData>[],
|
|
567
|
+
workflowNode?: WorkflowNodeRecord,
|
|
568
|
+
nodeType?: WorkflowNodeMetadataResponse,
|
|
569
|
+
) {
|
|
570
|
+
if (!subset.length) {
|
|
571
|
+
return;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
const bounds = subset.reduce(
|
|
575
|
+
(acc, node) => {
|
|
576
|
+
const rect = getNodeRect(node);
|
|
577
|
+
return {
|
|
578
|
+
left: Math.min(acc.left, rect.left),
|
|
579
|
+
top: Math.min(acc.top, rect.top),
|
|
580
|
+
right: Math.max(acc.right, rect.right),
|
|
581
|
+
bottom: Math.max(acc.bottom, rect.bottom),
|
|
582
|
+
};
|
|
583
|
+
},
|
|
584
|
+
{
|
|
585
|
+
left: Number.POSITIVE_INFINITY,
|
|
586
|
+
top: Number.POSITIVE_INFINITY,
|
|
587
|
+
right: Number.NEGATIVE_INFINITY,
|
|
588
|
+
bottom: Number.NEGATIVE_INFINITY,
|
|
589
|
+
},
|
|
590
|
+
);
|
|
591
|
+
|
|
592
|
+
const paddingX =
|
|
593
|
+
tone === "loop" ? DIMENSIONS.loopGroupPaddingX : DIMENSIONS.groupPaddingX;
|
|
594
|
+
const paddingTop =
|
|
595
|
+
tone === "loop" ? DIMENSIONS.loopGroupPaddingTop : DIMENSIONS.groupPaddingTop;
|
|
596
|
+
const paddingBottom =
|
|
597
|
+
tone === "loop" ? DIMENSIONS.loopGroupPaddingBottom : DIMENSIONS.groupPaddingBottom;
|
|
598
|
+
|
|
599
|
+
ctx.backgroundNodes.push({
|
|
600
|
+
id,
|
|
601
|
+
type: "group",
|
|
602
|
+
position: {
|
|
603
|
+
x: bounds.left - paddingX,
|
|
604
|
+
y: bounds.top - paddingTop,
|
|
605
|
+
},
|
|
606
|
+
draggable: false,
|
|
607
|
+
selectable: false,
|
|
608
|
+
style: {
|
|
609
|
+
width: bounds.right - bounds.left + paddingX * 2,
|
|
610
|
+
height: bounds.bottom - bounds.top + paddingTop + paddingBottom,
|
|
611
|
+
zIndex: 0,
|
|
612
|
+
},
|
|
613
|
+
data: {
|
|
614
|
+
kind: "group",
|
|
615
|
+
label,
|
|
616
|
+
tone,
|
|
617
|
+
workflowNode,
|
|
618
|
+
nodeType,
|
|
619
|
+
onViewDocs: ctx.onViewDocs,
|
|
620
|
+
},
|
|
621
|
+
});
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
function pushInsertNode(
|
|
625
|
+
ctx: GraphBuildContext,
|
|
626
|
+
id: string,
|
|
627
|
+
x: number,
|
|
628
|
+
y: number,
|
|
629
|
+
target: WorkflowInsertTarget,
|
|
630
|
+
) {
|
|
631
|
+
ctx.nodes.push({
|
|
632
|
+
id,
|
|
633
|
+
type: "insert",
|
|
634
|
+
position: { x, y },
|
|
635
|
+
draggable: false,
|
|
636
|
+
selectable: false,
|
|
637
|
+
data: {
|
|
638
|
+
kind: "insert",
|
|
639
|
+
enabled: !!ctx.activePaletteNodeType,
|
|
640
|
+
selectedTypeLabel: ctx.activePaletteNodeType?.label,
|
|
641
|
+
onInsert: () => ctx.onInsertNode(target),
|
|
642
|
+
},
|
|
643
|
+
sourcePosition: Position.Bottom,
|
|
644
|
+
targetPosition: Position.Top,
|
|
645
|
+
});
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
function pushWorkflowNode(
|
|
649
|
+
ctx: GraphBuildContext,
|
|
650
|
+
workflowNode: WorkflowNodeRecord,
|
|
651
|
+
x: number,
|
|
652
|
+
y: number,
|
|
653
|
+
) {
|
|
654
|
+
const nodeType = ctx.nodeTypeMap.get(String(workflowNode.type));
|
|
655
|
+
ctx.nodes.push({
|
|
656
|
+
id: String(workflowNode.id),
|
|
657
|
+
type: "workflow",
|
|
658
|
+
position: { x, y },
|
|
659
|
+
draggable: false,
|
|
660
|
+
data: {
|
|
661
|
+
kind: "workflow-node",
|
|
662
|
+
workflowNode,
|
|
663
|
+
nodeType,
|
|
664
|
+
selected: ctx.selectedNodeId === String(workflowNode.id),
|
|
665
|
+
readOnly: ctx.readOnly,
|
|
666
|
+
onSelectNode: ctx.onSelectNode,
|
|
667
|
+
onEditNode: ctx.onEditNode,
|
|
668
|
+
onDeleteNode: ctx.onDeleteNode,
|
|
669
|
+
onViewDocs: ctx.onViewDocs,
|
|
670
|
+
},
|
|
671
|
+
sourcePosition: Position.Bottom,
|
|
672
|
+
targetPosition: Position.Top,
|
|
673
|
+
});
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
function pushTriggerNode(
|
|
677
|
+
ctx: GraphBuildContext,
|
|
678
|
+
trigger: WorkflowTriggerRecord,
|
|
679
|
+
x: number,
|
|
680
|
+
y: number,
|
|
681
|
+
) {
|
|
682
|
+
ctx.nodes.push({
|
|
683
|
+
id: `trigger-${String(trigger.id)}`,
|
|
684
|
+
type: "trigger",
|
|
685
|
+
position: { x, y },
|
|
686
|
+
draggable: false,
|
|
687
|
+
selectable: false,
|
|
688
|
+
sourcePosition: Position.Bottom,
|
|
689
|
+
targetPosition: Position.Top,
|
|
690
|
+
data: {
|
|
691
|
+
kind: "workflow-trigger",
|
|
692
|
+
trigger,
|
|
693
|
+
selected: ctx.selectedTriggerId === String(trigger.id),
|
|
694
|
+
readOnly: ctx.readOnly,
|
|
695
|
+
onSelectTrigger: ctx.onSelectTrigger,
|
|
696
|
+
onViewDocs: ctx.onViewTriggerDocs,
|
|
697
|
+
},
|
|
698
|
+
});
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
type ReadOnlySequenceLayoutResult = {
|
|
702
|
+
entryIds: string[];
|
|
703
|
+
exitIds: string[];
|
|
704
|
+
endY: number;
|
|
705
|
+
width: number;
|
|
706
|
+
};
|
|
707
|
+
|
|
708
|
+
function pushSectionLabelNode(
|
|
709
|
+
ctx: GraphBuildContext,
|
|
710
|
+
id: string,
|
|
711
|
+
x: number,
|
|
712
|
+
y: number,
|
|
713
|
+
label: string,
|
|
714
|
+
) {
|
|
715
|
+
ctx.nodes.push({
|
|
716
|
+
id,
|
|
717
|
+
type: "sectionLabel",
|
|
718
|
+
position: { x, y },
|
|
719
|
+
draggable: false,
|
|
720
|
+
selectable: false,
|
|
721
|
+
data: {
|
|
722
|
+
kind: "section-label",
|
|
723
|
+
label,
|
|
724
|
+
},
|
|
725
|
+
});
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
function buildSequenceGraph(
|
|
729
|
+
sequence: WorkflowNodeRecord[],
|
|
730
|
+
ctx: GraphBuildContext,
|
|
731
|
+
laneX: number,
|
|
732
|
+
startY: number,
|
|
733
|
+
scope: WorkflowInsertScope,
|
|
734
|
+
): WorkflowLayoutResult {
|
|
735
|
+
let cursorY = startY;
|
|
736
|
+
let previousGraphNodeId: string | null = null;
|
|
737
|
+
let maxWidth = DIMENSIONS.workflowWidth;
|
|
738
|
+
|
|
739
|
+
const initialInsertId = `insert-${JSON.stringify(scope)}-0`;
|
|
740
|
+
pushInsertNode(ctx, initialInsertId, laneX, cursorY, {
|
|
741
|
+
...scope,
|
|
742
|
+
index: 0,
|
|
743
|
+
} as WorkflowInsertTarget);
|
|
744
|
+
previousGraphNodeId = initialInsertId;
|
|
745
|
+
let exitId = initialInsertId;
|
|
746
|
+
|
|
747
|
+
for (let index = 0; index < sequence.length; index += 1) {
|
|
748
|
+
const workflowNode = sequence[index];
|
|
749
|
+
const nodeType = ctx.nodeTypeMap.get(String(workflowNode.type));
|
|
750
|
+
const slotDefinitions = normalizeChildSlots(workflowNode, nodeType);
|
|
751
|
+
const isControlNode = nodeType?.kind === "control" || slotDefinitions.length > 0;
|
|
752
|
+
const estimatedNodeWidth = estimateWorkflowNodeWidth(
|
|
753
|
+
workflowNode,
|
|
754
|
+
ctx.nodeTypeMap,
|
|
755
|
+
nodeType,
|
|
756
|
+
);
|
|
757
|
+
maxWidth = Math.max(maxWidth, estimatedNodeWidth);
|
|
758
|
+
const subtreeStartIndex = ctx.nodes.length;
|
|
759
|
+
|
|
760
|
+
cursorY += 82;
|
|
761
|
+
pushWorkflowNode(ctx, workflowNode, laneX - 56, cursorY);
|
|
762
|
+
if (previousGraphNodeId) {
|
|
763
|
+
ctx.edges.push(createEdge(previousGraphNodeId, String(workflowNode.id)));
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
let deepestY = cursorY;
|
|
767
|
+
let connectionSources: string[] = [String(workflowNode.id)];
|
|
768
|
+
|
|
769
|
+
const branchSlots = slotDefinitions.filter(
|
|
770
|
+
(slot) => slot.key === "then" || slot.key === "else",
|
|
771
|
+
);
|
|
772
|
+
|
|
773
|
+
if (branchSlots.length >= 2) {
|
|
774
|
+
const branchGap = 60;
|
|
775
|
+
const branchWidths = branchSlots.map((slot) =>
|
|
776
|
+
estimateSequenceWidth(
|
|
777
|
+
Array.isArray(workflowNode[slot.key]) ? workflowNode[slot.key] : [],
|
|
778
|
+
ctx.nodeTypeMap,
|
|
779
|
+
),
|
|
780
|
+
);
|
|
781
|
+
const totalBranchWidth =
|
|
782
|
+
branchWidths.reduce((sum, width) => sum + width, 0) +
|
|
783
|
+
branchGap * Math.max(branchWidths.length - 1, 0);
|
|
784
|
+
const branchStartX = laneX - totalBranchWidth / 2;
|
|
785
|
+
const branchLayouts = branchSlots.map((slot, branchIndex) => {
|
|
786
|
+
const slotKey = slot.key as "then" | "else";
|
|
787
|
+
const childNodes = Array.isArray(workflowNode[slotKey]) ? workflowNode[slotKey] : [];
|
|
788
|
+
const beforeWidth = branchWidths
|
|
789
|
+
.slice(0, branchIndex)
|
|
790
|
+
.reduce((sum, width) => sum + width, 0);
|
|
791
|
+
const branchLaneX =
|
|
792
|
+
branchStartX +
|
|
793
|
+
beforeWidth +
|
|
794
|
+
branchGap * branchIndex +
|
|
795
|
+
branchWidths[branchIndex] / 2;
|
|
796
|
+
const labelX = branchLaneX + 24;
|
|
797
|
+
const labelY = cursorY + 60;
|
|
798
|
+
pushSectionLabelNode(
|
|
799
|
+
ctx,
|
|
800
|
+
`${workflowNode.id}-${slotKey}-label`,
|
|
801
|
+
labelX,
|
|
802
|
+
labelY,
|
|
803
|
+
slot.label ?? slotKey,
|
|
804
|
+
);
|
|
805
|
+
const childLayout = buildSequenceGraph(
|
|
806
|
+
childNodes,
|
|
807
|
+
ctx,
|
|
808
|
+
branchLaneX,
|
|
809
|
+
cursorY + 82,
|
|
810
|
+
{
|
|
811
|
+
scope: "slot",
|
|
812
|
+
parentNodeId: String(workflowNode.id),
|
|
813
|
+
slotKey,
|
|
814
|
+
},
|
|
815
|
+
);
|
|
816
|
+
ctx.edges.push(createEdge(String(workflowNode.id), childLayout.entryId));
|
|
817
|
+
deepestY = Math.max(deepestY, childLayout.endY);
|
|
818
|
+
maxWidth = Math.max(maxWidth, childLayout.width);
|
|
819
|
+
return childLayout;
|
|
820
|
+
});
|
|
821
|
+
|
|
822
|
+
connectionSources = branchLayouts.map((layout) => layout.exitId);
|
|
823
|
+
} else if (slotDefinitions.length === 1 && slotDefinitions[0].kind === "sequence") {
|
|
824
|
+
const slot = slotDefinitions[0];
|
|
825
|
+
const slotKey = slot.key as "children" | "nodes" | "then" | "else";
|
|
826
|
+
const childNodes = Array.isArray(workflowNode[slotKey]) ? workflowNode[slotKey] : [];
|
|
827
|
+
if (slot.label) {
|
|
828
|
+
const isLoop = isLoopNode(workflowNode, nodeType);
|
|
829
|
+
pushSectionLabelNode(
|
|
830
|
+
ctx,
|
|
831
|
+
`${workflowNode.id}-${slotKey}-label`,
|
|
832
|
+
laneX + 24,
|
|
833
|
+
cursorY + (isLoop ? DIMENSIONS.controlChildLabelOffsetY : 132),
|
|
834
|
+
isLoop ? slot.label ?? "Loop Body" : slot.label,
|
|
835
|
+
);
|
|
836
|
+
}
|
|
837
|
+
const childLayout = buildSequenceGraph(
|
|
838
|
+
childNodes,
|
|
839
|
+
ctx,
|
|
840
|
+
laneX,
|
|
841
|
+
cursorY + DIMENSIONS.controlChildStartOffsetY,
|
|
842
|
+
{
|
|
843
|
+
scope: "slot",
|
|
844
|
+
parentNodeId: String(workflowNode.id),
|
|
845
|
+
slotKey,
|
|
846
|
+
},
|
|
847
|
+
);
|
|
848
|
+
ctx.edges.push(createEdge(String(workflowNode.id), childLayout.entryId));
|
|
849
|
+
deepestY = Math.max(deepestY, childLayout.endY);
|
|
850
|
+
maxWidth = Math.max(maxWidth, childLayout.width);
|
|
851
|
+
connectionSources = [childLayout.exitId];
|
|
852
|
+
} else if (slotDefinitions.length === 1 && slotDefinitions[0].kind === "branch-collection") {
|
|
853
|
+
const branches = Array.isArray(workflowNode.branches) ? workflowNode.branches : [];
|
|
854
|
+
const branchGap = 56;
|
|
855
|
+
const branchWidths = branches.map((branch: any) =>
|
|
856
|
+
estimateSequenceWidth(Array.isArray(branch.nodes) ? branch.nodes : [], ctx.nodeTypeMap),
|
|
857
|
+
);
|
|
858
|
+
const totalBranchWidth =
|
|
859
|
+
branchWidths.reduce((sum, width) => sum + width, 0) +
|
|
860
|
+
branchGap * Math.max(branchWidths.length - 1, 0);
|
|
861
|
+
const branchStartX = laneX - totalBranchWidth / 2;
|
|
862
|
+
|
|
863
|
+
const branchLayouts = branches.map((branch: any, branchIndex) => {
|
|
864
|
+
const beforeWidth = branchWidths
|
|
865
|
+
.slice(0, branchIndex)
|
|
866
|
+
.reduce((sum, width) => sum + width, 0);
|
|
867
|
+
const branchLaneX =
|
|
868
|
+
branchStartX +
|
|
869
|
+
beforeWidth +
|
|
870
|
+
branchGap * branchIndex +
|
|
871
|
+
branchWidths[branchIndex] / 2;
|
|
872
|
+
pushSectionLabelNode(
|
|
873
|
+
ctx,
|
|
874
|
+
`${workflowNode.id}-${branch.id}-label`,
|
|
875
|
+
branchLaneX + 24,
|
|
876
|
+
cursorY + 60,
|
|
877
|
+
branch.name ?? branch.id,
|
|
878
|
+
);
|
|
879
|
+
const branchLayout = buildSequenceGraph(
|
|
880
|
+
Array.isArray(branch.nodes) ? branch.nodes : [],
|
|
881
|
+
ctx,
|
|
882
|
+
branchLaneX,
|
|
883
|
+
cursorY + 82,
|
|
884
|
+
{
|
|
885
|
+
scope: "branch",
|
|
886
|
+
parentNodeId: String(workflowNode.id),
|
|
887
|
+
branchId: String(branch.id),
|
|
888
|
+
},
|
|
889
|
+
);
|
|
890
|
+
ctx.edges.push(createEdge(String(workflowNode.id), branchLayout.entryId));
|
|
891
|
+
deepestY = Math.max(deepestY, branchLayout.endY);
|
|
892
|
+
maxWidth = Math.max(maxWidth, branchLayout.width);
|
|
893
|
+
return branchLayout;
|
|
894
|
+
});
|
|
895
|
+
|
|
896
|
+
connectionSources = branchLayouts.length
|
|
897
|
+
? branchLayouts.map((layout) => layout.exitId)
|
|
898
|
+
: [String(workflowNode.id)];
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
if (isControlNode) {
|
|
902
|
+
pushGroupNode(
|
|
903
|
+
ctx,
|
|
904
|
+
`group-${String(workflowNode.id)}`,
|
|
905
|
+
workflowNode.name ?? workflowNode.id,
|
|
906
|
+
isLoopNode(workflowNode, nodeType) ? "loop" : "control",
|
|
907
|
+
ctx.nodes.slice(subtreeStartIndex),
|
|
908
|
+
workflowNode,
|
|
909
|
+
nodeType,
|
|
910
|
+
);
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
cursorY = Math.max(cursorY + 82, deepestY + (isControlNode ? 40 : 0));
|
|
914
|
+
const afterInsertId = `insert-${JSON.stringify(scope)}-${index + 1}-${workflowNode.id}`;
|
|
915
|
+
pushInsertNode(ctx, afterInsertId, laneX, cursorY, {
|
|
916
|
+
...scope,
|
|
917
|
+
index: index + 1,
|
|
918
|
+
} as WorkflowInsertTarget);
|
|
919
|
+
connectionSources.forEach((sourceId) => {
|
|
920
|
+
ctx.edges.push(createEdge(sourceId, afterInsertId));
|
|
921
|
+
});
|
|
922
|
+
previousGraphNodeId = afterInsertId;
|
|
923
|
+
exitId = afterInsertId;
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
return {
|
|
927
|
+
entryId: initialInsertId,
|
|
928
|
+
exitId,
|
|
929
|
+
endY: cursorY,
|
|
930
|
+
width: maxWidth,
|
|
931
|
+
};
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
function buildReadOnlySequenceGraph(
|
|
935
|
+
sequence: WorkflowNodeRecord[],
|
|
936
|
+
ctx: GraphBuildContext,
|
|
937
|
+
laneX: number,
|
|
938
|
+
startY: number,
|
|
939
|
+
): ReadOnlySequenceLayoutResult {
|
|
940
|
+
let cursorY = startY;
|
|
941
|
+
let previousExitIds: string[] = [];
|
|
942
|
+
let entryIds: string[] = [];
|
|
943
|
+
let maxWidth = sequence.length ? DIMENSIONS.workflowWidth : 0;
|
|
944
|
+
|
|
945
|
+
for (const workflowNode of sequence) {
|
|
946
|
+
const nodeType = ctx.nodeTypeMap.get(String(workflowNode.type));
|
|
947
|
+
const slotDefinitions = normalizeChildSlots(workflowNode, nodeType);
|
|
948
|
+
const isControlNode = nodeType?.kind === "control" || slotDefinitions.length > 0;
|
|
949
|
+
const estimatedNodeWidth = estimateWorkflowNodeWidth(
|
|
950
|
+
workflowNode,
|
|
951
|
+
ctx.nodeTypeMap,
|
|
952
|
+
nodeType,
|
|
953
|
+
);
|
|
954
|
+
maxWidth = Math.max(maxWidth, estimatedNodeWidth);
|
|
955
|
+
const subtreeStartIndex = ctx.nodes.length;
|
|
956
|
+
|
|
957
|
+
cursorY += 82;
|
|
958
|
+
pushWorkflowNode(ctx, workflowNode, laneX - 56, cursorY);
|
|
959
|
+
|
|
960
|
+
if (!entryIds.length) {
|
|
961
|
+
entryIds = [String(workflowNode.id)];
|
|
962
|
+
}
|
|
963
|
+
previousExitIds.forEach((sourceId) => {
|
|
964
|
+
ctx.edges.push(createEdge(sourceId, String(workflowNode.id)));
|
|
965
|
+
});
|
|
966
|
+
|
|
967
|
+
let deepestY = cursorY;
|
|
968
|
+
let exitIds: string[] = [String(workflowNode.id)];
|
|
969
|
+
|
|
970
|
+
const branchSlots = slotDefinitions.filter(
|
|
971
|
+
(slot) => slot.key === "then" || slot.key === "else",
|
|
972
|
+
);
|
|
973
|
+
|
|
974
|
+
if (branchSlots.length >= 2) {
|
|
975
|
+
const branchGap = 60;
|
|
976
|
+
const branchWidths = branchSlots.map((slot) =>
|
|
977
|
+
estimateSequenceWidth(
|
|
978
|
+
Array.isArray(workflowNode[slot.key]) ? workflowNode[slot.key] : [],
|
|
979
|
+
ctx.nodeTypeMap,
|
|
980
|
+
),
|
|
981
|
+
);
|
|
982
|
+
const totalBranchWidth =
|
|
983
|
+
branchWidths.reduce((sum, width) => sum + width, 0) +
|
|
984
|
+
branchGap * Math.max(branchWidths.length - 1, 0);
|
|
985
|
+
const branchStartX = laneX - totalBranchWidth / 2;
|
|
986
|
+
|
|
987
|
+
const branchLayouts = branchSlots
|
|
988
|
+
.map((slot, branchIndex) => {
|
|
989
|
+
const slotKey = slot.key as "then" | "else";
|
|
990
|
+
const childNodes = Array.isArray(workflowNode[slotKey])
|
|
991
|
+
? workflowNode[slotKey]
|
|
992
|
+
: [];
|
|
993
|
+
const beforeWidth = branchWidths
|
|
994
|
+
.slice(0, branchIndex)
|
|
995
|
+
.reduce((sum, width) => sum + width, 0);
|
|
996
|
+
const branchLaneX =
|
|
997
|
+
branchStartX +
|
|
998
|
+
beforeWidth +
|
|
999
|
+
branchGap * branchIndex +
|
|
1000
|
+
branchWidths[branchIndex] / 2;
|
|
1001
|
+
pushSectionLabelNode(
|
|
1002
|
+
ctx,
|
|
1003
|
+
`${workflowNode.id}-${slotKey}-label`,
|
|
1004
|
+
branchLaneX + 24,
|
|
1005
|
+
cursorY + 60,
|
|
1006
|
+
slot.label ?? slotKey,
|
|
1007
|
+
);
|
|
1008
|
+
const childLayout = buildReadOnlySequenceGraph(
|
|
1009
|
+
childNodes,
|
|
1010
|
+
ctx,
|
|
1011
|
+
branchLaneX,
|
|
1012
|
+
cursorY + 82,
|
|
1013
|
+
);
|
|
1014
|
+
childLayout.entryIds.forEach((entryId) => {
|
|
1015
|
+
ctx.edges.push(createEdge(String(workflowNode.id), entryId));
|
|
1016
|
+
});
|
|
1017
|
+
deepestY = Math.max(deepestY, childLayout.endY);
|
|
1018
|
+
maxWidth = Math.max(maxWidth, childLayout.width);
|
|
1019
|
+
return childLayout;
|
|
1020
|
+
})
|
|
1021
|
+
.filter((layout) => layout.entryIds.length);
|
|
1022
|
+
|
|
1023
|
+
exitIds = branchLayouts.length
|
|
1024
|
+
? branchLayouts.flatMap((layout) => layout.exitIds)
|
|
1025
|
+
: [String(workflowNode.id)];
|
|
1026
|
+
} else if (slotDefinitions.length === 1 && slotDefinitions[0].kind === "sequence") {
|
|
1027
|
+
const slot = slotDefinitions[0];
|
|
1028
|
+
const slotKey = slot.key as "children" | "nodes" | "then" | "else";
|
|
1029
|
+
const childNodes = Array.isArray(workflowNode[slotKey]) ? workflowNode[slotKey] : [];
|
|
1030
|
+
if (slot.label) {
|
|
1031
|
+
const isLoop = isLoopNode(workflowNode, nodeType);
|
|
1032
|
+
pushSectionLabelNode(
|
|
1033
|
+
ctx,
|
|
1034
|
+
`${workflowNode.id}-${slotKey}-label`,
|
|
1035
|
+
laneX + 24,
|
|
1036
|
+
cursorY + (isLoop ? DIMENSIONS.controlChildLabelOffsetY : 132),
|
|
1037
|
+
isLoop ? slot.label ?? "Loop Body" : slot.label,
|
|
1038
|
+
);
|
|
1039
|
+
}
|
|
1040
|
+
const childLayout = buildReadOnlySequenceGraph(
|
|
1041
|
+
childNodes,
|
|
1042
|
+
ctx,
|
|
1043
|
+
laneX,
|
|
1044
|
+
cursorY + DIMENSIONS.controlChildStartOffsetY,
|
|
1045
|
+
);
|
|
1046
|
+
childLayout.entryIds.forEach((entryId) => {
|
|
1047
|
+
ctx.edges.push(createEdge(String(workflowNode.id), entryId));
|
|
1048
|
+
});
|
|
1049
|
+
deepestY = Math.max(deepestY, childLayout.endY);
|
|
1050
|
+
maxWidth = Math.max(maxWidth, childLayout.width);
|
|
1051
|
+
exitIds = childLayout.exitIds.length ? childLayout.exitIds : [String(workflowNode.id)];
|
|
1052
|
+
} else if (slotDefinitions.length === 1 && slotDefinitions[0].kind === "branch-collection") {
|
|
1053
|
+
const branches = Array.isArray(workflowNode.branches) ? workflowNode.branches : [];
|
|
1054
|
+
const branchGap = 56;
|
|
1055
|
+
const branchWidths = branches.map((branch: any) =>
|
|
1056
|
+
estimateSequenceWidth(Array.isArray(branch.nodes) ? branch.nodes : [], ctx.nodeTypeMap),
|
|
1057
|
+
);
|
|
1058
|
+
const totalBranchWidth =
|
|
1059
|
+
branchWidths.reduce((sum, width) => sum + width, 0) +
|
|
1060
|
+
branchGap * Math.max(branchWidths.length - 1, 0);
|
|
1061
|
+
const branchStartX = laneX - totalBranchWidth / 2;
|
|
1062
|
+
|
|
1063
|
+
const branchLayouts = branches
|
|
1064
|
+
.map((branch: any, branchIndex) => {
|
|
1065
|
+
const beforeWidth = branchWidths
|
|
1066
|
+
.slice(0, branchIndex)
|
|
1067
|
+
.reduce((sum, width) => sum + width, 0);
|
|
1068
|
+
const branchLaneX =
|
|
1069
|
+
branchStartX +
|
|
1070
|
+
beforeWidth +
|
|
1071
|
+
branchGap * branchIndex +
|
|
1072
|
+
branchWidths[branchIndex] / 2;
|
|
1073
|
+
pushSectionLabelNode(
|
|
1074
|
+
ctx,
|
|
1075
|
+
`${workflowNode.id}-${branch.id}-label`,
|
|
1076
|
+
branchLaneX + 24,
|
|
1077
|
+
cursorY + 60,
|
|
1078
|
+
branch.name ?? branch.id,
|
|
1079
|
+
);
|
|
1080
|
+
const branchLayout = buildReadOnlySequenceGraph(
|
|
1081
|
+
Array.isArray(branch.nodes) ? branch.nodes : [],
|
|
1082
|
+
ctx,
|
|
1083
|
+
branchLaneX,
|
|
1084
|
+
cursorY + 82,
|
|
1085
|
+
);
|
|
1086
|
+
branchLayout.entryIds.forEach((entryId) => {
|
|
1087
|
+
ctx.edges.push(createEdge(String(workflowNode.id), entryId));
|
|
1088
|
+
});
|
|
1089
|
+
deepestY = Math.max(deepestY, branchLayout.endY);
|
|
1090
|
+
maxWidth = Math.max(maxWidth, branchLayout.width);
|
|
1091
|
+
return branchLayout;
|
|
1092
|
+
})
|
|
1093
|
+
.filter((layout) => layout.entryIds.length);
|
|
1094
|
+
|
|
1095
|
+
exitIds = branchLayouts.length
|
|
1096
|
+
? branchLayouts.flatMap((layout) => layout.exitIds)
|
|
1097
|
+
: [String(workflowNode.id)];
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
if (isControlNode) {
|
|
1101
|
+
pushGroupNode(
|
|
1102
|
+
ctx,
|
|
1103
|
+
`group-${String(workflowNode.id)}`,
|
|
1104
|
+
workflowNode.name ?? workflowNode.id,
|
|
1105
|
+
isLoopNode(workflowNode, nodeType) ? "loop" : "control",
|
|
1106
|
+
ctx.nodes.slice(subtreeStartIndex),
|
|
1107
|
+
workflowNode,
|
|
1108
|
+
nodeType,
|
|
1109
|
+
);
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
cursorY = Math.max(cursorY + 82, deepestY + (isControlNode ? 40 : 0));
|
|
1113
|
+
previousExitIds = exitIds;
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1116
|
+
return {
|
|
1117
|
+
entryIds,
|
|
1118
|
+
exitIds: previousExitIds,
|
|
1119
|
+
endY: cursorY,
|
|
1120
|
+
width: maxWidth,
|
|
1121
|
+
};
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
function buildGraph(
|
|
1125
|
+
definition: { nodes: WorkflowNodeRecord[]; triggers?: WorkflowTriggerRecord[] },
|
|
1126
|
+
nodeTypes: WorkflowNodeMetadataResponse[],
|
|
1127
|
+
props: Omit<WorkflowFlowCanvasProps, "definition" | "nodeTypes">,
|
|
1128
|
+
) {
|
|
1129
|
+
const ctx: GraphBuildContext = {
|
|
1130
|
+
backgroundNodes: [],
|
|
1131
|
+
nodes: [],
|
|
1132
|
+
edges: [],
|
|
1133
|
+
nodeTypeMap: new Map(nodeTypes.map((item) => [item.type, item])),
|
|
1134
|
+
readOnly: props.readOnly,
|
|
1135
|
+
activePaletteNodeType: props.activePaletteNodeType,
|
|
1136
|
+
selectedNodeId: props.selectedNodeId,
|
|
1137
|
+
selectedTriggerId: props.selectedTriggerId,
|
|
1138
|
+
onSelectNode: props.onSelectNode,
|
|
1139
|
+
onSelectTrigger: props.onSelectTrigger,
|
|
1140
|
+
onEditNode: props.onEditNode,
|
|
1141
|
+
onDeleteNode: props.onDeleteNode,
|
|
1142
|
+
onViewDocs: props.onViewDocs,
|
|
1143
|
+
onViewTriggerDocs: props.onViewTriggerDocs,
|
|
1144
|
+
onInsertNode: props.onInsertNode,
|
|
1145
|
+
onAddBranch: props.onAddBranch,
|
|
1146
|
+
};
|
|
1147
|
+
|
|
1148
|
+
const triggers = Array.isArray(definition.triggers) ? definition.triggers : [];
|
|
1149
|
+
let startY = 0;
|
|
1150
|
+
let previousTriggerId: string | null = null;
|
|
1151
|
+
|
|
1152
|
+
if (triggers.length) {
|
|
1153
|
+
const triggerStartIndex = ctx.nodes.length;
|
|
1154
|
+
let triggerY = 60;
|
|
1155
|
+
triggers.forEach((trigger) => {
|
|
1156
|
+
const triggerNodeId = `trigger-${String(trigger.id)}`;
|
|
1157
|
+
pushTriggerNode(ctx, trigger, 32, triggerY);
|
|
1158
|
+
if (previousTriggerId) {
|
|
1159
|
+
ctx.edges.push(createEdge(previousTriggerId, triggerNodeId));
|
|
1160
|
+
}
|
|
1161
|
+
previousTriggerId = triggerNodeId;
|
|
1162
|
+
triggerY += 96;
|
|
1163
|
+
});
|
|
1164
|
+
pushGroupNode(ctx, "group-triggers", "Triggers", "trigger", ctx.nodes.slice(triggerStartIndex));
|
|
1165
|
+
startY = triggerY + 2;
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1168
|
+
if (props.readOnly) {
|
|
1169
|
+
const readOnlyLayout = buildReadOnlySequenceGraph(
|
|
1170
|
+
definition.nodes ?? [],
|
|
1171
|
+
ctx,
|
|
1172
|
+
80,
|
|
1173
|
+
startY,
|
|
1174
|
+
);
|
|
1175
|
+
if (previousTriggerId) {
|
|
1176
|
+
const triggerSourceId = previousTriggerId;
|
|
1177
|
+
readOnlyLayout.entryIds.forEach((entryId) => {
|
|
1178
|
+
ctx.edges.push(createEdge(triggerSourceId, entryId));
|
|
1179
|
+
});
|
|
1180
|
+
}
|
|
1181
|
+
} else {
|
|
1182
|
+
buildSequenceGraph(definition.nodes ?? [], ctx, 80, startY, { scope: "root" });
|
|
1183
|
+
if (previousTriggerId) {
|
|
1184
|
+
const firstRootInsertId = `insert-${JSON.stringify({ scope: "root" })}-0`;
|
|
1185
|
+
ctx.edges.push(createEdge(previousTriggerId, firstRootInsertId));
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1189
|
+
return {
|
|
1190
|
+
nodes: [...ctx.backgroundNodes, ...ctx.nodes],
|
|
1191
|
+
edges: ctx.edges,
|
|
1192
|
+
};
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1195
|
+
function WorkflowFlowCanvasInner(props: WorkflowFlowCanvasProps) {
|
|
1196
|
+
const graph = React.useMemo(
|
|
1197
|
+
() =>
|
|
1198
|
+
buildGraph(props.definition, props.nodeTypes, {
|
|
1199
|
+
selectedNodeId: props.selectedNodeId,
|
|
1200
|
+
selectedTriggerId: props.selectedTriggerId,
|
|
1201
|
+
activePaletteNodeType: props.activePaletteNodeType,
|
|
1202
|
+
onSelectNode: props.onSelectNode,
|
|
1203
|
+
onSelectTrigger: props.onSelectTrigger,
|
|
1204
|
+
onEditNode: props.onEditNode,
|
|
1205
|
+
onDeleteNode: props.onDeleteNode,
|
|
1206
|
+
onViewDocs: props.onViewDocs,
|
|
1207
|
+
onViewTriggerDocs: props.onViewTriggerDocs,
|
|
1208
|
+
onInsertNode: props.onInsertNode,
|
|
1209
|
+
onAddBranch: props.onAddBranch,
|
|
1210
|
+
readOnly: props.readOnly,
|
|
1211
|
+
}),
|
|
1212
|
+
[
|
|
1213
|
+
props.activePaletteNodeType,
|
|
1214
|
+
props.definition,
|
|
1215
|
+
props.nodeTypes,
|
|
1216
|
+
props.onAddBranch,
|
|
1217
|
+
props.onDeleteNode,
|
|
1218
|
+
props.onEditNode,
|
|
1219
|
+
props.onInsertNode,
|
|
1220
|
+
props.onSelectNode,
|
|
1221
|
+
props.onSelectTrigger,
|
|
1222
|
+
props.onViewDocs,
|
|
1223
|
+
props.onViewTriggerDocs,
|
|
1224
|
+
props.readOnly,
|
|
1225
|
+
props.selectedNodeId,
|
|
1226
|
+
props.selectedTriggerId,
|
|
1227
|
+
],
|
|
1228
|
+
);
|
|
1229
|
+
|
|
1230
|
+
return (
|
|
1231
|
+
<div
|
|
1232
|
+
className={`workflow-flow-canvas ${props.readOnly ? "workflow-flow-canvas--readonly" : ""}`}
|
|
1233
|
+
>
|
|
1234
|
+
<ReactFlow
|
|
1235
|
+
nodes={graph.nodes}
|
|
1236
|
+
edges={graph.edges}
|
|
1237
|
+
nodeTypes={canvasNodeTypes}
|
|
1238
|
+
fitView
|
|
1239
|
+
fitViewOptions={{
|
|
1240
|
+
padding: props.readOnly ? 0.28 : 0.24,
|
|
1241
|
+
maxZoom: props.readOnly ? 0.92 : 1,
|
|
1242
|
+
}}
|
|
1243
|
+
minZoom={0.25}
|
|
1244
|
+
maxZoom={1.6}
|
|
1245
|
+
proOptions={{ hideAttribution: true }}
|
|
1246
|
+
defaultEdgeOptions={{ zIndex: 2 }}
|
|
1247
|
+
nodesDraggable={false}
|
|
1248
|
+
nodesConnectable={false}
|
|
1249
|
+
elementsSelectable={!props.readOnly}
|
|
1250
|
+
panOnDrag
|
|
1251
|
+
zoomOnDoubleClick={false}
|
|
1252
|
+
>
|
|
1253
|
+
{!props.readOnly ? (
|
|
1254
|
+
<MiniMap pannable zoomable className="workflow-flow-canvas__minimap" />
|
|
1255
|
+
) : null}
|
|
1256
|
+
<Controls showInteractive={false} />
|
|
1257
|
+
<Background
|
|
1258
|
+
variant={BackgroundVariant.Dots}
|
|
1259
|
+
gap={18}
|
|
1260
|
+
size={1.45}
|
|
1261
|
+
color="rgba(148, 163, 184, 0.34)"
|
|
1262
|
+
/>
|
|
1263
|
+
</ReactFlow>
|
|
1264
|
+
</div>
|
|
1265
|
+
);
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1268
|
+
export function WorkflowFlowCanvas(props: WorkflowFlowCanvasProps) {
|
|
1269
|
+
return (
|
|
1270
|
+
<ReactFlowProvider>
|
|
1271
|
+
<WorkflowFlowCanvasInner {...props} />
|
|
1272
|
+
</ReactFlowProvider>
|
|
1273
|
+
);
|
|
1274
|
+
}
|