@elyx-code/editor-ui 0.0.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/README.md +2 -0
- package/package.json +109 -0
- package/src/App.tsx +31 -0
- package/src/Router.tsx +115 -0
- package/src/__mocks__/defaultModuleMock.ts +1 -0
- package/src/__mocks__/fileMock.ts +1 -0
- package/src/__mocks__/styleMock.ts +1 -0
- package/src/assets/Clock-11.1s-18px.svg +16 -0
- package/src/assets/Clock-11.1s-28px.svg +16 -0
- package/src/assets/authentication.svg +1 -0
- package/src/assets/canvas-backdrop-0.png +0 -0
- package/src/assets/canvas-backdrop-1.png +0 -0
- package/src/assets/canvas-backdrop-2.png +0 -0
- package/src/assets/canvas-backdrop-3.png +0 -0
- package/src/assets/canvas-backdrop-4.png +0 -0
- package/src/assets/canvas-backdrop-5.png +0 -0
- package/src/assets/canvas-backdrop.png +0 -0
- package/src/assets/checkmark-animation.gif +0 -0
- package/src/assets/checkmark-animation.mp4 +0 -0
- package/src/assets/code-formatting/format-black.svg +6 -0
- package/src/assets/code-formatting/format-dark-grey.svg +6 -0
- package/src/assets/code-formatting/format-light-grey.svg +6 -0
- package/src/assets/code-formatting/format-white.svg +6 -0
- package/src/assets/code-formatting/inline-black.svg +5 -0
- package/src/assets/code-formatting/inline-dark-grey.svg +5 -0
- package/src/assets/code-formatting/inline-light-grey.svg +5 -0
- package/src/assets/code-formatting/inline-white.svg +5 -0
- package/src/assets/contained-logo-full-word.png +0 -0
- package/src/assets/cron-job-color.png +0 -0
- package/src/assets/cron-job.png +0 -0
- package/src/assets/database-table-color.png +0 -0
- package/src/assets/database-table.png +0 -0
- package/src/assets/datatype-icons/black/any.svg +1 -0
- package/src/assets/datatype-icons/black/binary.svg +1 -0
- package/src/assets/datatype-icons/black/boolean.svg +3 -0
- package/src/assets/datatype-icons/black/date-time.svg +3 -0
- package/src/assets/datatype-icons/black/definition-entity.svg +6 -0
- package/src/assets/datatype-icons/black/key-file.svg +1 -0
- package/src/assets/datatype-icons/black/list.svg +3 -0
- package/src/assets/datatype-icons/black/null.svg +3 -0
- package/src/assets/datatype-icons/black/number.svg +13 -0
- package/src/assets/datatype-icons/black/project.svg +12 -0
- package/src/assets/datatype-icons/black/sql-program.svg +2 -0
- package/src/assets/datatype-icons/black/text.svg +3 -0
- package/src/assets/datatype-icons/black/unknown.svg +3 -0
- package/src/assets/datatype-icons/black/uuid.svg +4 -0
- package/src/assets/datatype-icons/black/void.svg +1 -0
- package/src/assets/datatype-icons/dark-grey/any.svg +1 -0
- package/src/assets/datatype-icons/dark-grey/boolean.svg +3 -0
- package/src/assets/datatype-icons/dark-grey/date-time.svg +3 -0
- package/src/assets/datatype-icons/dark-grey/definition-entity.svg +6 -0
- package/src/assets/datatype-icons/dark-grey/list.svg +3 -0
- package/src/assets/datatype-icons/dark-grey/null.svg +3 -0
- package/src/assets/datatype-icons/dark-grey/number.svg +13 -0
- package/src/assets/datatype-icons/dark-grey/project.svg +12 -0
- package/src/assets/datatype-icons/dark-grey/sql-program.svg +2 -0
- package/src/assets/datatype-icons/dark-grey/text.svg +3 -0
- package/src/assets/datatype-icons/dark-grey/unknown.svg +3 -0
- package/src/assets/datatype-icons/dark-grey/uuid.svg +4 -0
- package/src/assets/datatype-icons/dark-grey/void.svg +1 -0
- package/src/assets/datatype-icons/light-grey/any.svg +1 -0
- package/src/assets/datatype-icons/light-grey/boolean.svg +3 -0
- package/src/assets/datatype-icons/light-grey/date-time.svg +3 -0
- package/src/assets/datatype-icons/light-grey/definition-entity.svg +6 -0
- package/src/assets/datatype-icons/light-grey/list.svg +3 -0
- package/src/assets/datatype-icons/light-grey/null.svg +3 -0
- package/src/assets/datatype-icons/light-grey/number.svg +13 -0
- package/src/assets/datatype-icons/light-grey/project.svg +12 -0
- package/src/assets/datatype-icons/light-grey/sql-program.svg +2 -0
- package/src/assets/datatype-icons/light-grey/text.svg +3 -0
- package/src/assets/datatype-icons/light-grey/unknown.svg +3 -0
- package/src/assets/datatype-icons/light-grey/uuid.svg +4 -0
- package/src/assets/datatype-icons/light-grey/void.svg +1 -0
- package/src/assets/edit.png +0 -0
- package/src/assets/execution.svg +13 -0
- package/src/assets/favicon.svg +14 -0
- package/src/assets/file-search.svg +1 -0
- package/src/assets/http-endpoint.png +0 -0
- package/src/assets/image-input-placeholder.png +0 -0
- package/src/assets/logo-full-word-white.png +0 -0
- package/src/assets/logo-full-word.png +0 -0
- package/src/assets/password.svg +85 -0
- package/src/assets/pencil.png +0 -0
- package/src/assets/publish-project-rich-icon-2.svg +1 -0
- package/src/assets/publish-project-rich-icon.svg +1 -0
- package/src/assets/relational-database.png +0 -0
- package/src/assets/resources.svg +3 -0
- package/src/assets/resume-icon-14px.png +0 -0
- package/src/assets/server.png +0 -0
- package/src/assets/small-status/checkmark.svg +4 -0
- package/src/assets/small-status/error.svg +4 -0
- package/src/assets/small-status/loading.svg +4 -0
- package/src/assets/small-status/skipped.svg +11 -0
- package/src/assets/sql-connection-config.svg +1 -0
- package/src/assets/sql-row-transformer.svg +1 -0
- package/src/assets/ssl-certificate-config.svg +1 -0
- package/src/assets/sync.svg +1 -0
- package/src/assets/testing-logic-icon.svg +1 -0
- package/src/assets/versions.svg +25 -0
- package/src/assets/visual-programming-icon.svg +1 -0
- package/src/assets/warning-sign-24px.png +0 -0
- package/src/auth/index.ts +318 -0
- package/src/components/DialogLoader.tsx +94 -0
- package/src/components/EntityDialogHeader.tsx +110 -0
- package/src/components/EntityDialogSectionHeader.tsx +214 -0
- package/src/components/GalleryAddExternalIntegrationInfoDialog.tsx +87 -0
- package/src/components/GenerateProjectStartingLogicPromptDialog.tsx +281 -0
- package/src/components/LegacyRouteRedirector.tsx +55 -0
- package/src/components/ProPlanChip.tsx +23 -0
- package/src/components/ReportBugDialog.tsx +412 -0
- package/src/components/RequestIntegrationAccessDialog.tsx +261 -0
- package/src/components/UseTemplateProjectDialog.tsx +193 -0
- package/src/components/WorkspaceLayout.tsx +152 -0
- package/src/components/animated-svg/AnimatedCheckmark.tsx +41 -0
- package/src/components/animated-svg/AnimatedCrossmark.tsx +51 -0
- package/src/components/animated-svg/AnimatedEmailSending.tsx +38 -0
- package/src/components/animated-svg/AnimatedLoading.tsx +72 -0
- package/src/components/animated-svg/animated-svg.css +239 -0
- package/src/components/canvas/Canvas.tsx +16 -0
- package/src/components/canvas/CreateEntityMenu.tsx +2020 -0
- package/src/components/canvas/canvas.css +10 -0
- package/src/components/canvas/create-entity-menu.css +579 -0
- package/src/components/canvas-search/CanvasSearch.tsx +501 -0
- package/src/components/canvas-search/canvas-search.css +126 -0
- package/src/components/canvas-settings-menu/CanvasSettingsMenuButton.tsx +515 -0
- package/src/components/canvas-settings-menu/canvas-settings-menu.css +96 -0
- package/src/components/circular-image-upload/CircularImageUpload.tsx +113 -0
- package/src/components/circular-image-upload/circular-image-upload.css +69 -0
- package/src/components/costs/CostsDialog.tsx +459 -0
- package/src/components/data-type/DataTypeBuilder.tsx +3127 -0
- package/src/components/data-type/data-type-builder.css +45 -0
- package/src/components/dialogs/BetaAcknowledgeDialog.tsx +43 -0
- package/src/components/dialogs/ComplexDataDialog.tsx +458 -0
- package/src/components/dialogs/CronBuilderDialog.tsx +2145 -0
- package/src/components/dialogs/ExternalIntegrationConnections.tsx +565 -0
- package/src/components/dialogs/JsonEditorDialog.tsx +1392 -0
- package/src/components/dialogs/StringEditorDialog.tsx +268 -0
- package/src/components/dialogs/argument-declaration/ArgumentDeclaration.tsx +1167 -0
- package/src/components/dialogs/argument-declaration/ArgumentDeclarationDialogContent.tsx +128 -0
- package/src/components/dialogs/beta-dialog.css +165 -0
- package/src/components/dialogs/condition/Condition.tsx +431 -0
- package/src/components/dialogs/condition/ConditionDialogContent.tsx +126 -0
- package/src/components/dialogs/definition-entity/DefinitionEntityDialogContent.tsx +973 -0
- package/src/components/dialogs/function-call/FunctionCall.tsx +442 -0
- package/src/components/dialogs/function-call/FunctionCallDialogContent.tsx +126 -0
- package/src/components/dialogs/function-declaration/FunctionDeclaration.tsx +926 -0
- package/src/components/dialogs/function-declaration/FunctionDeclarationDialogContent.tsx +124 -0
- package/src/components/dialogs/generating-project-starting-logic-overlay/GeneratingProjectStartingLogicOverlay.tsx +176 -0
- package/src/components/dialogs/generating-project-starting-logic-overlay/generating-project-starting-logic-overlay.css +13 -0
- package/src/components/dialogs/global-event/GlobalEvent.tsx +475 -0
- package/src/components/dialogs/global-event/GlobalEventDialogContent.tsx +126 -0
- package/src/components/dialogs/help/HelpDialog.tsx +217 -0
- package/src/components/dialogs/help/HelpDilalogHomeContent.tsx +178 -0
- package/src/components/dialogs/help/help-dialog.css +116 -0
- package/src/components/dialogs/help/help-icon/HelpIconButton.tsx +41 -0
- package/src/components/dialogs/help/help-icon/help-icon.css +9 -0
- package/src/components/dialogs/input-map/InputMap.tsx +635 -0
- package/src/components/dialogs/input-map/InputMapDialogContent.tsx +126 -0
- package/src/components/dialogs/json-editor-dialog.css +4 -0
- package/src/components/dialogs/loop/Loop.tsx +650 -0
- package/src/components/dialogs/loop/LoopDialogContent.tsx +122 -0
- package/src/components/dialogs/operation/Operation.tsx +440 -0
- package/src/components/dialogs/operation/OperationDialogContent.tsx +126 -0
- package/src/components/dialogs/output-map/OutputMap.tsx +536 -0
- package/src/components/dialogs/output-map/OutputMapDialogContent.tsx +126 -0
- package/src/components/dialogs/property/Property.tsx +1490 -0
- package/src/components/dialogs/property/PropertyDialogContent.tsx +106 -0
- package/src/components/dialogs/search-statement/ColumnSelector.tsx +334 -0
- package/src/components/dialogs/search-statement/ConditionBuilder.tsx +750 -0
- package/src/components/dialogs/search-statement/DataAggregationSection.tsx +621 -0
- package/src/components/dialogs/search-statement/DataSourceSelection.tsx +734 -0
- package/src/components/dialogs/search-statement/EntityMetadataSection.tsx +135 -0
- package/src/components/dialogs/search-statement/FilterConditionsSection.tsx +151 -0
- package/src/components/dialogs/search-statement/InlineInputMap.tsx +153 -0
- package/src/components/dialogs/search-statement/LiteralValue.tsx +616 -0
- package/src/components/dialogs/search-statement/MainSourceAndInputsSection.tsx +271 -0
- package/src/components/dialogs/search-statement/NestedSearchStatementBuilder.tsx +170 -0
- package/src/components/dialogs/search-statement/OutputFormatSection.tsx +1779 -0
- package/src/components/dialogs/search-statement/ResultsSection.tsx +344 -0
- package/src/components/dialogs/search-statement/SearchStatementBuilder.tsx +251 -0
- package/src/components/dialogs/search-statement/SearchStatementDialogContent.tsx +398 -0
- package/src/components/dialogs/search-statement/ValueSelector.tsx +766 -0
- package/src/components/dialogs/search-statement/search-statement-context.tsx +1630 -0
- package/src/components/dialogs/search-statement/search-statement-dialog.css +56 -0
- package/src/components/dialogs/search-statement/test.sql +111 -0
- package/src/components/dialogs/value-descriptor/ValueDescriptor.tsx +824 -0
- package/src/components/dialogs/value-descriptor/ValueDescriptorDialogContent.tsx +124 -0
- package/src/components/dialogs/variable-declaration/VariableDeclaration.tsx +836 -0
- package/src/components/dialogs/variable-declaration/VariableDeclarationDialogContent.tsx +106 -0
- package/src/components/dialogs/variable-instance/VariableInstance.tsx +443 -0
- package/src/components/dialogs/variable-instance/VariableInstanceDialogContent.tsx +124 -0
- package/src/components/draggable-entity-card/ArgumentDeclaration.tsx +736 -0
- package/src/components/draggable-entity-card/CollapseEntityButton.tsx +170 -0
- package/src/components/draggable-entity-card/ConditionCard.tsx +1062 -0
- package/src/components/draggable-entity-card/ConnectionDeleteButton.tsx +309 -0
- package/src/components/draggable-entity-card/DataTypeIcon.tsx +624 -0
- package/src/components/draggable-entity-card/DraggableEntityCard.tsx +617 -0
- package/src/components/draggable-entity-card/ErrorMapProperty.tsx +464 -0
- package/src/components/draggable-entity-card/EventCard.tsx +700 -0
- package/src/components/draggable-entity-card/ExecutionInProgressValue.tsx +327 -0
- package/src/components/draggable-entity-card/FunctionDeclarationCard.tsx +819 -0
- package/src/components/draggable-entity-card/InputMapProperty.tsx +1067 -0
- package/src/components/draggable-entity-card/InternalCall.tsx +978 -0
- package/src/components/draggable-entity-card/InternalCallExecutionNode.tsx +643 -0
- package/src/components/draggable-entity-card/LogicScopeCallerNode.tsx +262 -0
- package/src/components/draggable-entity-card/LoopCard.tsx +791 -0
- package/src/components/draggable-entity-card/MainValueInput.tsx +523 -0
- package/src/components/draggable-entity-card/MainValueOutput.tsx +458 -0
- package/src/components/draggable-entity-card/MethodDeclaration.tsx +1088 -0
- package/src/components/draggable-entity-card/NestedCondition.tsx +1025 -0
- package/src/components/draggable-entity-card/OutputMapProperty.tsx +843 -0
- package/src/components/draggable-entity-card/PassthroughEntityCard.tsx +1247 -0
- package/src/components/draggable-entity-card/ReturnedError.tsx +549 -0
- package/src/components/draggable-entity-card/SmallSuccessFailureNodes.tsx +523 -0
- package/src/components/draggable-entity-card/SuccessFailureNodes.tsx +509 -0
- package/src/components/draggable-entity-card/TestEntityButton.tsx +946 -0
- package/src/components/draggable-entity-card/TestMenu.tsx +523 -0
- package/src/components/draggable-entity-card/TestMenuValidationDropdown.tsx +84 -0
- package/src/components/draggable-entity-card/UnreachableMarker.tsx +114 -0
- package/src/components/draggable-entity-card/VariableCard.tsx +1577 -0
- package/src/components/draggable-entity-card/VariableScopeMarker.tsx +117 -0
- package/src/components/draggable-entity-card/collapse-entity-button.css +44 -0
- package/src/components/draggable-entity-card/definition-entity/DefinitionEntityCard.tsx +1181 -0
- package/src/components/draggable-entity-card/definition-entity/DefinitionEntityIcon.tsx +36 -0
- package/src/components/draggable-entity-card/definition-entity/DefinitionEntityProperty.tsx +478 -0
- package/src/components/draggable-entity-card/definition-entity/DynamicFooterActions.tsx +112 -0
- package/src/components/draggable-entity-card/definition-entity/actions/external-integration-connection/ExportCredentialsFooterAction.tsx +461 -0
- package/src/components/draggable-entity-card/definition-entity/actions/external-integration-connection/RestablishConnectionFooterAction.tsx +199 -0
- package/src/components/draggable-entity-card/definition-entity/actions/external-integration-connection/restablish-connection-footer-action.css +85 -0
- package/src/components/draggable-entity-card/definition-entity/actions/google-drive/GoogleDriveFilePickerAPIFooterAction.tsx +277 -0
- package/src/components/draggable-entity-card/definition-entity/actions/google-drive/google-drive-file-picker-api-footer-action.css +107 -0
- package/src/components/draggable-entity-card/definition-entity/actions/persisted-entity/DatabaseFooterAction.tsx +452 -0
- package/src/components/draggable-entity-card/definition-entity/actions/persisted-entity/database-footer-action.css +86 -0
- package/src/components/draggable-entity-card/definition-entity/definition-entity-card.css +17 -0
- package/src/components/draggable-entity-card/draggable-entity-card.css +1140 -0
- package/src/components/draggable-entity-card/entity-locked-icon/EntityLockedIcon.tsx +133 -0
- package/src/components/draggable-entity-card/entity-locked-icon/entity-locked.css +8 -0
- package/src/components/draggable-entity-card/expand-properties-icon-button/ExpandPropertiesIconButton.tsx +84 -0
- package/src/components/draggable-entity-card/expand-properties-icon-button/expand-properties-icon-button.css +21 -0
- package/src/components/draggable-entity-card/implement-entity-icon/ImplementEntityIcon.tsx +74 -0
- package/src/components/draggable-entity-card/implement-entity-icon/implement-entity-icon.css +13 -0
- package/src/components/draggable-entity-card/logic-error/LogicErrorIconMenu.tsx +424 -0
- package/src/components/draggable-entity-card/logic-error/logic-error.css +23 -0
- package/src/components/draggable-entity-card/new-card-input-button/NewCardInputButton.tsx +193 -0
- package/src/components/draggable-entity-card/new-card-input-button/NewDynamicInputButton.tsx +214 -0
- package/src/components/draggable-entity-card/new-card-input-button/new-card-input-button.css +71 -0
- package/src/components/draggable-entity-card/new-card-output-button/NewCardOutputButton.tsx +192 -0
- package/src/components/draggable-entity-card/new-card-output-button/new-card-output-button.css +71 -0
- package/src/components/draggable-entity-card/termination-statement/TerminationStatementCard.tsx +1543 -0
- package/src/components/draggable-entity-card/termination-statement/termination-statement-card.css +17 -0
- package/src/components/draggable-entity-card/test-entity-button.css +55 -0
- package/src/components/draggable-entity-card/test-menu.css +181 -0
- package/src/components/draggable-entity-card/unreachable-marker.css +43 -0
- package/src/components/draggable-entity-card/variable-scope-marker.css +22 -0
- package/src/components/dynamic-value/DynamicValue.tsx +2395 -0
- package/src/components/dynamic-value/DynamicValueEntry.tsx +1957 -0
- package/src/components/dynamic-value/dynamic-value.css +230 -0
- package/src/components/editor/ElyxMonacoEditor.tsx +38 -0
- package/src/components/entity-error/EntityErrorListItem.tsx +47 -0
- package/src/components/entity-error/entity-error.css +198 -0
- package/src/components/entity-icon/EntityIcon.tsx +292 -0
- package/src/components/entity-icon/entity-icon.css +39 -0
- package/src/components/gallery-card/CreateNewProject.tsx +222 -0
- package/src/components/gallery-card/GalleryCard.tsx +171 -0
- package/src/components/gallery-card/MarketplaceCard.tsx +87 -0
- package/src/components/gallery-card/ProjectDuplicationCard.tsx +575 -0
- package/src/components/gallery-card/gallery-card.css +25 -0
- package/src/components/notifications/NotificationsIconButton.tsx +124 -0
- package/src/components/notifications/NotificationsPanel.tsx +385 -0
- package/src/components/notifications/notifications.css +189 -0
- package/src/components/online-users/LocalOnlineUsers.tsx +175 -0
- package/src/components/online-users/PageOnlineUsers.tsx +297 -0
- package/src/components/online-users/online-users.css +72 -0
- package/src/components/page-backdrop/PageBackdrop.tsx +8 -0
- package/src/components/page-backdrop/page-backdrop.css +7 -0
- package/src/components/project-configuration/DeleteProjectConfirmationDialog.tsx +134 -0
- package/src/components/project-configuration/ProjectConfigurationDialog.tsx +972 -0
- package/src/components/project-configuration/ProjectDataForm.tsx +121 -0
- package/src/components/project-configuration/UnpublishProjectConfirmationDialog.tsx +162 -0
- package/src/components/project-configuration/project-configuration-content.css +209 -0
- package/src/components/project-name/ProjectName.tsx +2025 -0
- package/src/components/project-name/project-name.css +599 -0
- package/src/components/publishing/Publication.tsx +133 -0
- package/src/components/publishing/history/PublicationHistoryContent.tsx +414 -0
- package/src/components/publishing/history/PublicationHistoryDialog.tsx +234 -0
- package/src/components/publishing/preview/PublicationPreviewDialog.tsx +1158 -0
- package/src/components/publishing/preview/PublishingPriceForecast.tsx +160 -0
- package/src/components/publishing/preview/PublishingResourcesDetails.tsx +91 -0
- package/src/components/publishing/publication-sequence/PublishingSequenceContent.tsx +375 -0
- package/src/components/publishing/publication-sequence/PublishingSequenceDialog.tsx +344 -0
- package/src/components/publishing/publishing-dialog.css +142 -0
- package/src/components/publishing/utils.ts +227 -0
- package/src/components/resources/ResourcesDialog.tsx +591 -0
- package/src/components/resources/UpgradeBanner.tsx +102 -0
- package/src/components/resources/codebase/CodebaseDetails.tsx +156 -0
- package/src/components/resources/cron-job/CronJobsList.tsx +532 -0
- package/src/components/resources/functions/FunctionsList.tsx +454 -0
- package/src/components/resources/http-api/HttpAPI.tsx +566 -0
- package/src/components/resources/http-api/HttpAPIClientModule.tsx +37 -0
- package/src/components/resources/logs/LogsViewer.tsx +768 -0
- package/src/components/resources/query.ts +74 -0
- package/src/components/resources/relational-database/DatabaseTable.tsx +905 -0
- package/src/components/resources/relational-database/RelationalDatabase.tsx +83 -0
- package/src/components/resources/relational-database/RelationalDatabaseSecrets.tsx +361 -0
- package/src/components/resources/resources-dialog.css +74 -0
- package/src/components/test-relational-database/DatabaseTable.tsx +913 -0
- package/src/components/test-relational-database/TestDatabaseDialogContent.tsx +670 -0
- package/src/components/test-relational-database/query.ts +74 -0
- package/src/components/toolbar/ToolBar.tsx +236 -0
- package/src/components/toolbar/toolbar.css +78 -0
- package/src/components/transaction-history/TransactionHistoryDialog.tsx +268 -0
- package/src/components/user/CurrentUserAvatar.tsx +65 -0
- package/src/components/user/UserChip.tsx +62 -0
- package/src/components/user/user.css +39 -0
- package/src/components/user-profile/ChangePasswordForm.tsx +67 -0
- package/src/components/user-profile/OwnUserProfileContent.tsx +665 -0
- package/src/components/user-profile/PublicUserProfileContent.tsx +99 -0
- package/src/components/user-profile/UserDataForm.tsx +75 -0
- package/src/components/user-profile/UserProfileDialog.tsx +110 -0
- package/src/components/user-profile/user-profile-content.css +25 -0
- package/src/config.ts +130 -0
- package/src/globals.d.ts +13 -0
- package/src/index.html +27 -0
- package/src/index.tsx +23 -0
- package/src/lib/badge/Badge.tsx +35 -0
- package/src/lib/badge/badge.css +32 -0
- package/src/lib/button/Button.tsx +129 -0
- package/src/lib/button/button.css +145 -0
- package/src/lib/canvas/canvas-undo-redo.ts +263 -0
- package/src/lib/canvas/defs.ts +170 -0
- package/src/lib/canvas/index.test.ts +189 -0
- package/src/lib/canvas/index.ts +6999 -0
- package/src/lib/canvas/utils.ts +59 -0
- package/src/lib/card/Card.tsx +62 -0
- package/src/lib/card/LoadingCard.tsx +82 -0
- package/src/lib/card/card.css +259 -0
- package/src/lib/chip/Chip.tsx +79 -0
- package/src/lib/chip/chip.css +0 -0
- package/src/lib/dialog/Dialog.tsx +122 -0
- package/src/lib/dialog/SmallDialog.tsx +61 -0
- package/src/lib/dialog/dialog.css +40 -0
- package/src/lib/display-data-structure/index.tsx +21 -0
- package/src/lib/dropdown/CanvasDropdownMenuCard.tsx +68 -0
- package/src/lib/dropdown/CanvasDropdownMenuCardOption.tsx +136 -0
- package/src/lib/dropdown/DropdownButton.tsx +104 -0
- package/src/lib/dropdown/DropdownMenuCard.tsx +324 -0
- package/src/lib/dropdown/DropdownMenuPopup.tsx +27 -0
- package/src/lib/dropdown/dropdown-button.css +76 -0
- package/src/lib/dropdown/dropdown-menu.css +151 -0
- package/src/lib/json-editor/RawJsonEditor.tsx +137 -0
- package/src/lib/json-editor/json-editor.css +35 -0
- package/src/lib/loader/Loader.tsx +120 -0
- package/src/lib/loader/loader.css +38 -0
- package/src/lib/pagination/Pagination.tsx +64 -0
- package/src/lib/popup/CanvasPopupBaseComponent.tsx +103 -0
- package/src/lib/popup/Popup.tsx +243 -0
- package/src/lib/popup/popup.css +16 -0
- package/src/lib/table/RowForm.tsx +301 -0
- package/src/lib/table/Table.tsx +1069 -0
- package/src/lib/table/table.css +249 -0
- package/src/lib/table/types.ts +108 -0
- package/src/lib/text-area/TextArea.tsx +183 -0
- package/src/lib/text-area/text-area.css +156 -0
- package/src/lib/text-field/TextField.tsx +218 -0
- package/src/lib/text-field/index.ts +8 -0
- package/src/lib/text-field/text-field.css +201 -0
- package/src/lib/tooltip/Tooltip.tsx +24 -0
- package/src/lib/tooltip/tooltip.css +17 -0
- package/src/localization/index.ts +47 -0
- package/src/main.css +343 -0
- package/src/pages/Auth.tsx +848 -0
- package/src/pages/Editor.tsx +883 -0
- package/src/pages/ErrorPage.tsx +179 -0
- package/src/pages/Gallery.tsx +1693 -0
- package/src/pages/NewPaymentMethodCallback.tsx +53 -0
- package/src/pages/NotFoundPage.tsx +126 -0
- package/src/pages/PricingPlans.tsx +155 -0
- package/src/pages/auth.css +304 -0
- package/src/pages/gallery.css +421 -0
- package/src/payments/index.ts +187 -0
- package/src/popup-notification/index.ts +90 -0
- package/src/services/database/index.ts +1 -0
- package/src/services/database/utils.ts +1301 -0
- package/src/services/editor/CanvasElement.tsx +2934 -0
- package/src/services/editor/CanvasElementConnectionDeleteButton.ts +204 -0
- package/src/services/editor/CanvasPopup.tsx +749 -0
- package/src/services/editor/EditorService.ts +8157 -0
- package/src/services/editor/area.ts +1312 -0
- package/src/services/editor/connections.ts +1019 -0
- package/src/services/editor/create/condition.ts +25 -0
- package/src/services/editor/create/definition-entity.ts +29 -0
- package/src/services/editor/create/function-call.ts +25 -0
- package/src/services/editor/create/global-event.ts +33 -0
- package/src/services/editor/create/loop.ts +25 -0
- package/src/services/editor/create/operation.ts +30 -0
- package/src/services/editor/create/utils.ts +140 -0
- package/src/services/editor/create/variable-declaration.ts +135 -0
- package/src/services/editor/create/variable-instance.ts +100 -0
- package/src/services/editor/editor-ui-extensions-context.ts +43 -0
- package/src/services/editor/entities-metadata.json +9310 -0
- package/src/services/editor/icons.ts +1093 -0
- package/src/services/editor/index.ts +1 -0
- package/src/services/editor/layout.ts +102 -0
- package/src/services/editor/modules/built-in-function-implementations/base.ts +14 -0
- package/src/services/editor/modules/built-in-function-implementations/create-persisted-entity/index.ts +56 -0
- package/src/services/editor/modules/built-in-function-implementations/delete-persisted-entity/index.ts +55 -0
- package/src/services/editor/modules/built-in-function-implementations/index.ts +4 -0
- package/src/services/editor/modules/built-in-function-implementations/update-persisted-entity/index.ts +56 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/google-drive/get-files.ts +183 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/google-drive/list-drives.ts +124 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/google-drive/list-root-folders.ts +125 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/google-drive/smart-fetch-document.ts +702 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/google-drive/upload-document.ts +535 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/google-gemini/generate-content.ts +193 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/google-mail/get-emails.ts +586 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/google-mail/send-email.ts +386 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/index.ts +12 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/slack/channels.ts +240 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/slack/messages.ts +210 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/slack/replies.ts +200 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/slack/send-message.ts +177 -0
- package/src/services/editor/modules/operations-implementations/index.ts +1 -0
- package/src/services/editor/modules/search-node-implementation/index.ts +42 -0
- package/src/services/editor/modules/sql-migrations-generation.tsx +1054 -0
- package/src/services/editor/publication/publication.ts +578 -0
- package/src/services/editor/ui.ts +1348 -0
- package/src/services/editor/utils.ts +5868 -0
- package/src/services/editor/value-store.ts +619 -0
- package/src/services/execution/built-in-function-implementations.ts +422 -0
- package/src/services/execution/index.ts +4747 -0
- package/src/services/execution/logic.ts +121 -0
- package/src/services/execution/test-instance.tsx +2296 -0
- package/src/services/execution/utils.ts +33 -0
- package/src/services/execution/value-resolution.test.ts +424 -0
- package/src/services/execution/value-resolution.ts +4087 -0
- package/src/services/integrations/ExternalIntegrationsService.ts +439 -0
- package/src/services/integrations/api.ts +175 -0
- package/src/services/local-relational-database/idb_helper.ts +66 -0
- package/src/services/local-relational-database/index.ts +3308 -0
- package/src/services/local-relational-database/utils.ts +403 -0
- package/src/services/notifications/index.ts +525 -0
- package/src/services/user/index.ts +144 -0
- package/src/setupTests.ts +1 -0
- package/src/socket/socket.ts +248 -0
- package/src/socket/utils.ts +10 -0
- package/src/store/workspace.ts +12 -0
- package/src/theme.ts +19 -0
- package/src/utils/DOM.ts +39 -0
- package/src/utils/date.ts +169 -0
- package/src/utils/index.ts +158 -0
- package/src/utils/react.tsx +679 -0
- package/src/utils/testing.ts +103 -0
|
@@ -0,0 +1,1577 @@
|
|
|
1
|
+
import React, {
|
|
2
|
+
useCallback,
|
|
3
|
+
useEffect,
|
|
4
|
+
useLayoutEffect,
|
|
5
|
+
useMemo,
|
|
6
|
+
useRef,
|
|
7
|
+
useState
|
|
8
|
+
} from 'react';
|
|
9
|
+
import parse from 'style-to-object';
|
|
10
|
+
import {
|
|
11
|
+
EntityType,
|
|
12
|
+
ChangeSet,
|
|
13
|
+
ProjectState,
|
|
14
|
+
VariableInputMapState,
|
|
15
|
+
createStateFromTypeAndSubscribe,
|
|
16
|
+
ChangeSetEntityChangeType,
|
|
17
|
+
DefinitionEntityState,
|
|
18
|
+
PropertyState,
|
|
19
|
+
IPropertyTransfer,
|
|
20
|
+
DataTypeState,
|
|
21
|
+
ValueWritingEntityState,
|
|
22
|
+
getParentCanvasEntity,
|
|
23
|
+
CanvasEntityState,
|
|
24
|
+
checkIsBranchDependentOnBranch,
|
|
25
|
+
lowercaseFirstLetter,
|
|
26
|
+
VariableInstanceState,
|
|
27
|
+
OutputMapState,
|
|
28
|
+
VariableState,
|
|
29
|
+
getDeclaration,
|
|
30
|
+
resolveDataType,
|
|
31
|
+
addDisabledReasons,
|
|
32
|
+
CanvasEntityConnectionDisabledReason,
|
|
33
|
+
CanvasEntityDisabledReason,
|
|
34
|
+
CanvasEntityOtherDisabledReason,
|
|
35
|
+
CanvasEntityTestingDisabledReason,
|
|
36
|
+
ALL_CONNECTION_DISABLED_REASONS,
|
|
37
|
+
removeDisabledReasons,
|
|
38
|
+
READABLE_ENTITY_TYPES,
|
|
39
|
+
UserManagedEntityState,
|
|
40
|
+
getDeclarationOutputedError,
|
|
41
|
+
IActionOutputMapTransfer,
|
|
42
|
+
IValueDescriptorTransfer,
|
|
43
|
+
OutputMapParentChildRelation,
|
|
44
|
+
findNextAvailableName,
|
|
45
|
+
filterOutDuplicateEntitiesAsync,
|
|
46
|
+
inputOrOutputShouldBePartOfFinalVariableObjectValue,
|
|
47
|
+
BUILT_IN_BASE_ENTITY_IDS,
|
|
48
|
+
IPrimitiveEntityTransfer,
|
|
49
|
+
PrimitiveEntityState,
|
|
50
|
+
StateMutationAction,
|
|
51
|
+
flattenCallersWithCallType,
|
|
52
|
+
getParentCallerEntity
|
|
53
|
+
} from '@elyx-code/project-logic-tree';
|
|
54
|
+
import './draggable-entity-card.css';
|
|
55
|
+
import {
|
|
56
|
+
entityDisabledReasonToShortReadableError,
|
|
57
|
+
fromDisabledReasonsToCardState,
|
|
58
|
+
getCanvasEntityDOMId,
|
|
59
|
+
getCardGradientStatement,
|
|
60
|
+
resolveEntityColorClass,
|
|
61
|
+
safeResolveEntityName
|
|
62
|
+
} from '../../services/editor/ui';
|
|
63
|
+
import Button from '../../lib/button/Button';
|
|
64
|
+
import { Canvas } from '../../lib/canvas';
|
|
65
|
+
import DataTypeIcon from './DataTypeIcon';
|
|
66
|
+
import CanvasPopup, { useCanvasPopup } from '../../services/editor/CanvasPopup';
|
|
67
|
+
import CanvasPopupBaseComponent from '../../lib/popup/CanvasPopupBaseComponent';
|
|
68
|
+
import CanvasDropdownMenuCard from '../../lib/dropdown/CanvasDropdownMenuCard';
|
|
69
|
+
import VariableScopeMarker from './VariableScopeMarker';
|
|
70
|
+
import TestEntityButton from './TestEntityButton';
|
|
71
|
+
import MainValueInput from './MainValueInput';
|
|
72
|
+
import InputMapProperty from './InputMapProperty';
|
|
73
|
+
import OutputMapProperty from './OutputMapProperty';
|
|
74
|
+
import MainValueOutput from './MainValueOutput';
|
|
75
|
+
import SuccessFailureNodes from './SuccessFailureNodes';
|
|
76
|
+
import InternalCall from './InternalCall';
|
|
77
|
+
import LogicErrorIconMenu from './logic-error/LogicErrorIconMenu';
|
|
78
|
+
import NewCardInputButton from './new-card-input-button/NewCardInputButton';
|
|
79
|
+
import ExpandPropertiesIconButton from './expand-properties-icon-button/ExpandPropertiesIconButton';
|
|
80
|
+
import { ICanvasElementComponentProps } from '../../services/editor/CanvasElement';
|
|
81
|
+
import { ConnectionNodeType, EditorService } from '../../services/editor';
|
|
82
|
+
import DynamicValueEntry from '../dynamic-value/DynamicValueEntry';
|
|
83
|
+
import ErrorMapProperty from './ErrorMapProperty';
|
|
84
|
+
import EntityLockedIconMenu from './entity-locked-icon/EntityLockedIcon';
|
|
85
|
+
import UnreachableMarker from './UnreachableMarker';
|
|
86
|
+
import { popupNotification } from '../../popup-notification';
|
|
87
|
+
|
|
88
|
+
interface IVariableCardProps extends ICanvasElementComponentProps {
|
|
89
|
+
entity: VariableState;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const VariableCard = (props: IVariableCardProps) => {
|
|
93
|
+
const rootElementRef = useRef(null);
|
|
94
|
+
|
|
95
|
+
useEffect(() => {
|
|
96
|
+
const element = rootElementRef.current;
|
|
97
|
+
|
|
98
|
+
if (!!element && document.contains(element)) {
|
|
99
|
+
props.onMount?.(element);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// When the component is unmounted
|
|
103
|
+
return () => {
|
|
104
|
+
props.onUnmount?.();
|
|
105
|
+
};
|
|
106
|
+
}, []);
|
|
107
|
+
|
|
108
|
+
useEffect(() => {
|
|
109
|
+
const element = rootElementRef.current;
|
|
110
|
+
|
|
111
|
+
props.onUpdate?.(element);
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
useLayoutEffect(() => {
|
|
115
|
+
props.onBeforeUpdate?.();
|
|
116
|
+
}, []);
|
|
117
|
+
|
|
118
|
+
const [expandedInputs, setExpandedInputs] = useState<boolean>(false);
|
|
119
|
+
const [expandedOutputs, setExpandedOutputs] = useState<boolean>(false);
|
|
120
|
+
|
|
121
|
+
const [updateKey, setValue] = useState(0);
|
|
122
|
+
|
|
123
|
+
const useForceUpdate = () => {
|
|
124
|
+
return () => setValue((value) => value + 1);
|
|
125
|
+
};
|
|
126
|
+
const forceUpdate = useForceUpdate(); // Update the component
|
|
127
|
+
|
|
128
|
+
const [disabledReasons, setDisabledReasons] = useState<
|
|
129
|
+
CanvasEntityDisabledReason[]
|
|
130
|
+
>([]);
|
|
131
|
+
|
|
132
|
+
const hasErrorHandling =
|
|
133
|
+
props.entity.catchesError || !!props.entity.errorCalls.length;
|
|
134
|
+
const isGlobal = props.entity.parent === props.entity.project;
|
|
135
|
+
// All errors must be thrown, so it cannot handle errors
|
|
136
|
+
const cannotHandleErrors =
|
|
137
|
+
props.entity.type === EntityType.VariableDeclaration && isGlobal;
|
|
138
|
+
const isUsedForMethodCall =
|
|
139
|
+
props.entity.internalCalls.some((call) => !!call.calledBy.length) ||
|
|
140
|
+
props.entity.internalCalls.some(
|
|
141
|
+
(internalCall) =>
|
|
142
|
+
!![...internalCall.successCalls, ...internalCall.errorCalls]
|
|
143
|
+
.length
|
|
144
|
+
);
|
|
145
|
+
|
|
146
|
+
const memoizedCanvasPopupBody = useCallback(
|
|
147
|
+
(popup: CanvasPopup) => (
|
|
148
|
+
<CanvasPopupBaseComponent
|
|
149
|
+
id={
|
|
150
|
+
'canvas-small-entity-card-menu-button-' +
|
|
151
|
+
props.entity.id +
|
|
152
|
+
'--popup--body'
|
|
153
|
+
}
|
|
154
|
+
>
|
|
155
|
+
<CanvasDropdownMenuCard
|
|
156
|
+
options={[
|
|
157
|
+
{
|
|
158
|
+
project: props.project,
|
|
159
|
+
onClick: async () => {
|
|
160
|
+
await props.project.remove(props.entity.id);
|
|
161
|
+
},
|
|
162
|
+
label: 'Delete',
|
|
163
|
+
color: 'error',
|
|
164
|
+
iconEnd: 'fa-solid fa-trash-can',
|
|
165
|
+
disabled: !entity.deletable,
|
|
166
|
+
tooltip: 'Forever delete this variable',
|
|
167
|
+
parentCanvasObject: popup.self,
|
|
168
|
+
id:
|
|
169
|
+
`canvas--${entity.type}--` +
|
|
170
|
+
props.entity.id +
|
|
171
|
+
'--delete'
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
project: props.project,
|
|
175
|
+
onClick: async () => {
|
|
176
|
+
props.project?.canvas?.unselectAll();
|
|
177
|
+
|
|
178
|
+
EditorService.navigate(
|
|
179
|
+
`${props.project?.editorBasePath}/entity/${entity.type}/${props.entity.id}`
|
|
180
|
+
);
|
|
181
|
+
},
|
|
182
|
+
label: 'Edit',
|
|
183
|
+
iconEnd: 'fa-solid fa-pencil',
|
|
184
|
+
disabled: false,
|
|
185
|
+
tooltip: !props.entity.editable
|
|
186
|
+
? `This ${lowercaseFirstLetter(
|
|
187
|
+
READABLE_ENTITY_TYPES[props.entity.type]
|
|
188
|
+
.singular
|
|
189
|
+
)} has been locked and can no longer be edited`
|
|
190
|
+
: `Edit this ${lowercaseFirstLetter(
|
|
191
|
+
READABLE_ENTITY_TYPES[props.entity.type]
|
|
192
|
+
.singular
|
|
193
|
+
)}`,
|
|
194
|
+
parentCanvasObject: popup.self,
|
|
195
|
+
id:
|
|
196
|
+
`canvas--${entity.type}--` +
|
|
197
|
+
props.entity.id +
|
|
198
|
+
'--edit'
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
project: props.project,
|
|
202
|
+
onClick: async () => {
|
|
203
|
+
const changeSet =
|
|
204
|
+
props.project.logic.addChangeSet(
|
|
205
|
+
new ChangeSet(
|
|
206
|
+
props.project.logic,
|
|
207
|
+
ProjectState.sessionAuthor,
|
|
208
|
+
new Date().toISOString(),
|
|
209
|
+
entity,
|
|
210
|
+
false,
|
|
211
|
+
entity.type ===
|
|
212
|
+
EntityType.VariableDeclaration
|
|
213
|
+
? StateMutationAction.RecalculateVarDecl
|
|
214
|
+
: StateMutationAction.RecalculateVarInst
|
|
215
|
+
)
|
|
216
|
+
);
|
|
217
|
+
|
|
218
|
+
entity.afterAllChildrenInitialized(changeSet);
|
|
219
|
+
|
|
220
|
+
props.project.renderAndCloseChangeSet(
|
|
221
|
+
changeSet
|
|
222
|
+
);
|
|
223
|
+
},
|
|
224
|
+
label: 'Recalculate',
|
|
225
|
+
color: 'warning',
|
|
226
|
+
// Bug icon
|
|
227
|
+
iconEnd: 'fa-solid fa-bug',
|
|
228
|
+
disabled: false,
|
|
229
|
+
// Lower case the first letter of the resolved readable name
|
|
230
|
+
tooltip:
|
|
231
|
+
'Recalculate the state of this ' +
|
|
232
|
+
lowercaseFirstLetter(
|
|
233
|
+
READABLE_ENTITY_TYPES[props.entity.type]
|
|
234
|
+
.shortSingular
|
|
235
|
+
),
|
|
236
|
+
parentCanvasObject: popup.self,
|
|
237
|
+
id:
|
|
238
|
+
'canvas--' +
|
|
239
|
+
props.entity.type +
|
|
240
|
+
'-card--' +
|
|
241
|
+
props.entity.id +
|
|
242
|
+
'--recalculate'
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
project: props.project,
|
|
246
|
+
onClick: async () => {
|
|
247
|
+
let actionName = entity.catchesError
|
|
248
|
+
? StateMutationAction.ChangeVarInstToThrowErrors
|
|
249
|
+
: StateMutationAction.ChangeVarInstToThrowErrors;
|
|
250
|
+
|
|
251
|
+
if (
|
|
252
|
+
entity.type ===
|
|
253
|
+
EntityType.VariableDeclaration
|
|
254
|
+
) {
|
|
255
|
+
actionName = entity.catchesError
|
|
256
|
+
? StateMutationAction.ChangeVarDeclToThrowErrors
|
|
257
|
+
: StateMutationAction.ChangeVarDeclToCatchErrors;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
const changeSet =
|
|
261
|
+
props.project.logic.addChangeSet(
|
|
262
|
+
new ChangeSet(
|
|
263
|
+
props.project.logic,
|
|
264
|
+
ProjectState.sessionAuthor,
|
|
265
|
+
new Date().toISOString(),
|
|
266
|
+
entity,
|
|
267
|
+
false,
|
|
268
|
+
actionName
|
|
269
|
+
)
|
|
270
|
+
);
|
|
271
|
+
|
|
272
|
+
entity.metaSync(
|
|
273
|
+
{
|
|
274
|
+
catchesError: !entity.catchesError
|
|
275
|
+
},
|
|
276
|
+
changeSet
|
|
277
|
+
);
|
|
278
|
+
|
|
279
|
+
props.project.renderAndCloseChangeSet(
|
|
280
|
+
changeSet
|
|
281
|
+
);
|
|
282
|
+
},
|
|
283
|
+
label: hasErrorHandling
|
|
284
|
+
? 'Errors are caught'
|
|
285
|
+
: 'Errors terminate execution',
|
|
286
|
+
color: 'error',
|
|
287
|
+
disabled:
|
|
288
|
+
isUsedForMethodCall ||
|
|
289
|
+
(cannotHandleErrors && !hasErrorHandling) ||
|
|
290
|
+
!!entity.errorCalls.length,
|
|
291
|
+
iconEnd: hasErrorHandling
|
|
292
|
+
? 'fa-solid fa-xmark'
|
|
293
|
+
: 'fa-solid fa-ban',
|
|
294
|
+
subLabel: !!entity.errorCalls.length
|
|
295
|
+
? 'Error call connected nodes'
|
|
296
|
+
: entity.catchesError
|
|
297
|
+
? 'Click to throw error instead'
|
|
298
|
+
: 'Click to catch errors instead',
|
|
299
|
+
tooltip: (() => {
|
|
300
|
+
if (isUsedForMethodCall) {
|
|
301
|
+
return 'This variable is being used to call a method of its instance, it cannot be called itself';
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
if (cannotHandleErrors && !hasErrorHandling) {
|
|
305
|
+
return 'This variable is global, errors should terminate the project';
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
if (cannotHandleErrors && hasErrorHandling) {
|
|
309
|
+
return 'This variable is global, errors should terminate the project. Click to remove error handling';
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
if (!!entity.errorCalls.length) {
|
|
313
|
+
return 'Remove all connected nodes to the error branch if you want to throw the error instead';
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
if (entity.catchesError) {
|
|
317
|
+
return 'Currently, if an error occurs, all other branches will continue executing.';
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
return 'Currently, if an error occurs it will terminate all ongoing executions. Including paralel branches.';
|
|
321
|
+
})(),
|
|
322
|
+
parentCanvasObject: popup.self,
|
|
323
|
+
id:
|
|
324
|
+
`canvas--${entity.type}--` +
|
|
325
|
+
props.entity.id +
|
|
326
|
+
'--error-handling'
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
project: props.project,
|
|
330
|
+
onClick: async () => {
|
|
331
|
+
navigator.clipboard.writeText(props.entity.id);
|
|
332
|
+
popupNotification({
|
|
333
|
+
text: `Copied ID: ${props.entity.id}`,
|
|
334
|
+
color: 'success'
|
|
335
|
+
});
|
|
336
|
+
},
|
|
337
|
+
label: 'Copy ID',
|
|
338
|
+
color: 'warning',
|
|
339
|
+
iconEnd: 'fa-solid fa-bug',
|
|
340
|
+
tooltip:
|
|
341
|
+
'Copy this node ID to clipboard for debugging',
|
|
342
|
+
parentCanvasObject: popup.self,
|
|
343
|
+
id: 'copy-id-' + props.entity.id
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
project: props.project,
|
|
347
|
+
onClick: async () => {
|
|
348
|
+
await props.project.recalculateValidateEntity(
|
|
349
|
+
props.entity
|
|
350
|
+
);
|
|
351
|
+
popupNotification({
|
|
352
|
+
text: `Re-validated node successfully`,
|
|
353
|
+
color: 'success'
|
|
354
|
+
});
|
|
355
|
+
},
|
|
356
|
+
label: 'Re-validate',
|
|
357
|
+
color: 'warning',
|
|
358
|
+
iconEnd: 'fa-solid fa-bug',
|
|
359
|
+
tooltip:
|
|
360
|
+
"Re-validate this node's state and its errors",
|
|
361
|
+
parentCanvasObject: popup.self,
|
|
362
|
+
id: 're-validate-' + props.entity.id
|
|
363
|
+
}
|
|
364
|
+
]}
|
|
365
|
+
/>
|
|
366
|
+
</CanvasPopupBaseComponent>
|
|
367
|
+
),
|
|
368
|
+
[props.entity, props.project]
|
|
369
|
+
);
|
|
370
|
+
|
|
371
|
+
const canvasPopup = useCanvasPopup(
|
|
372
|
+
{
|
|
373
|
+
editor: props.project,
|
|
374
|
+
id:
|
|
375
|
+
'canvas-small-entity-card-menu-button-' +
|
|
376
|
+
props.entity.id +
|
|
377
|
+
'--popup',
|
|
378
|
+
anchorQuerySelector:
|
|
379
|
+
'#canvas-small-entity-card-menu-button-' + props.entity.id,
|
|
380
|
+
arrowClasses: ['dropdown-menu-card-arrow'],
|
|
381
|
+
parentCanvasObject: props.canvasElement.draggableObject,
|
|
382
|
+
arrowContainerSelector:
|
|
383
|
+
'#canvas-small-entity-card-menu-button-' +
|
|
384
|
+
props.entity.id +
|
|
385
|
+
'--popup--body'
|
|
386
|
+
},
|
|
387
|
+
memoizedCanvasPopupBody
|
|
388
|
+
);
|
|
389
|
+
|
|
390
|
+
useEffect(() => {
|
|
391
|
+
// Simple handler for deps that just need a rerender
|
|
392
|
+
const handleForceUpdate = () => {
|
|
393
|
+
forceUpdate();
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
const handleCanvasGloballyEnabled = () => {
|
|
397
|
+
setDisabledReasons((currentReasons) => {
|
|
398
|
+
const config = removeDisabledReasons(currentReasons, [
|
|
399
|
+
CanvasEntityOtherDisabledReason.CanvasGloballyDisabled
|
|
400
|
+
]);
|
|
401
|
+
return config.reasons;
|
|
402
|
+
});
|
|
403
|
+
};
|
|
404
|
+
const handleCanvasGloballyDisabled = () => {
|
|
405
|
+
setDisabledReasons((currentReasons) => {
|
|
406
|
+
const config = addDisabledReasons(currentReasons, [
|
|
407
|
+
CanvasEntityOtherDisabledReason.CanvasGloballyDisabled
|
|
408
|
+
]);
|
|
409
|
+
return config.reasons;
|
|
410
|
+
});
|
|
411
|
+
};
|
|
412
|
+
|
|
413
|
+
const handleEntityUpdate = (payload: any) => {
|
|
414
|
+
let hasUpdated = false;
|
|
415
|
+
const newDisabledReasons: CanvasEntityTestingDisabledReason[] = [];
|
|
416
|
+
const disabledReasonsToRemove: CanvasEntityTestingDisabledReason[] =
|
|
417
|
+
[];
|
|
418
|
+
|
|
419
|
+
props.project.test?.disabledConnectionsNotInTest(
|
|
420
|
+
props.canvasElement.draggableObject,
|
|
421
|
+
props.entity
|
|
422
|
+
);
|
|
423
|
+
|
|
424
|
+
if (
|
|
425
|
+
!!props.project.test &&
|
|
426
|
+
!props.project.test?.hasEntity(props.entity) &&
|
|
427
|
+
!props.project.test?.getCanBeAddedToTest(props.entity)
|
|
428
|
+
) {
|
|
429
|
+
props.project.canvas?.disable(
|
|
430
|
+
props.canvasElement.draggableObject,
|
|
431
|
+
{
|
|
432
|
+
quiet: true
|
|
433
|
+
}
|
|
434
|
+
);
|
|
435
|
+
newDisabledReasons.push(
|
|
436
|
+
CanvasEntityTestingDisabledReason.CannotBeAddedToTest
|
|
437
|
+
);
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
if (
|
|
441
|
+
(props.project.test?.hasEntity(props.entity) ||
|
|
442
|
+
props.project.test?.getCanBeAddedToTest(props.entity)) &&
|
|
443
|
+
props.canvasElement.draggableObject.disabled
|
|
444
|
+
) {
|
|
445
|
+
props.project.canvas?.enable(
|
|
446
|
+
props.canvasElement.draggableObject,
|
|
447
|
+
{
|
|
448
|
+
quiet: true
|
|
449
|
+
}
|
|
450
|
+
);
|
|
451
|
+
disabledReasonsToRemove.push(
|
|
452
|
+
CanvasEntityTestingDisabledReason.CannotBeAddedToTest
|
|
453
|
+
);
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
if (
|
|
457
|
+
!!props.project.test &&
|
|
458
|
+
!props.project.test?.hasEntity(props.entity)
|
|
459
|
+
) {
|
|
460
|
+
newDisabledReasons.push(
|
|
461
|
+
CanvasEntityTestingDisabledReason.NotPartOfOngoingTest
|
|
462
|
+
);
|
|
463
|
+
} else if (
|
|
464
|
+
!!props.project.test &&
|
|
465
|
+
props.project.test?.hasEntity(props.entity)
|
|
466
|
+
) {
|
|
467
|
+
disabledReasonsToRemove.push(
|
|
468
|
+
CanvasEntityTestingDisabledReason.NotPartOfOngoingTest
|
|
469
|
+
);
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
if (newDisabledReasons.length || disabledReasonsToRemove.length) {
|
|
473
|
+
setDisabledReasons((currentReasons) => {
|
|
474
|
+
const config = addDisabledReasons(
|
|
475
|
+
currentReasons,
|
|
476
|
+
newDisabledReasons
|
|
477
|
+
);
|
|
478
|
+
const finalConfig = removeDisabledReasons(
|
|
479
|
+
config.reasons,
|
|
480
|
+
disabledReasonsToRemove
|
|
481
|
+
);
|
|
482
|
+
return finalConfig.reasons;
|
|
483
|
+
});
|
|
484
|
+
hasUpdated = true;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
if (!hasUpdated) {
|
|
488
|
+
forceUpdate();
|
|
489
|
+
}
|
|
490
|
+
};
|
|
491
|
+
|
|
492
|
+
const handleTestSetupStarted = () => {
|
|
493
|
+
const newDisabledReasons: CanvasEntityTestingDisabledReason[] = [];
|
|
494
|
+
|
|
495
|
+
if (
|
|
496
|
+
!!props.project.test &&
|
|
497
|
+
!props.project.test?.hasEntity(props.entity) &&
|
|
498
|
+
!props.project.test?.getCanBeAddedToTest(props.entity)
|
|
499
|
+
) {
|
|
500
|
+
props.project.canvas?.disable(
|
|
501
|
+
props.canvasElement.draggableObject,
|
|
502
|
+
{
|
|
503
|
+
quiet: true
|
|
504
|
+
}
|
|
505
|
+
);
|
|
506
|
+
props.project.test?.disabledConnectionsNotInTest(
|
|
507
|
+
props.canvasElement.draggableObject,
|
|
508
|
+
props.entity
|
|
509
|
+
);
|
|
510
|
+
newDisabledReasons.push(
|
|
511
|
+
CanvasEntityTestingDisabledReason.CannotBeAddedToTest
|
|
512
|
+
);
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
if (!props.project.test?.hasEntity(props.entity)) {
|
|
516
|
+
newDisabledReasons.push(
|
|
517
|
+
CanvasEntityTestingDisabledReason.NotPartOfOngoingTest
|
|
518
|
+
);
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
setDisabledReasons((currentReasons) => {
|
|
522
|
+
const config = addDisabledReasons(
|
|
523
|
+
currentReasons,
|
|
524
|
+
newDisabledReasons
|
|
525
|
+
);
|
|
526
|
+
return config.reasons;
|
|
527
|
+
});
|
|
528
|
+
};
|
|
529
|
+
|
|
530
|
+
const handleExecutionStart = () => {
|
|
531
|
+
if (!!props.project.test?.hasEntity(props.entity)) {
|
|
532
|
+
forceUpdate();
|
|
533
|
+
}
|
|
534
|
+
};
|
|
535
|
+
|
|
536
|
+
const handleTestExited = () => {
|
|
537
|
+
setDisabledReasons((currentReasons) => {
|
|
538
|
+
const config = removeDisabledReasons(currentReasons, [
|
|
539
|
+
CanvasEntityTestingDisabledReason.NotPartOfOngoingTest,
|
|
540
|
+
CanvasEntityTestingDisabledReason.CannotBeAddedToTest
|
|
541
|
+
]);
|
|
542
|
+
return config.reasons;
|
|
543
|
+
});
|
|
544
|
+
|
|
545
|
+
if (props.canvasElement.draggableObject.disabled) {
|
|
546
|
+
props.project.canvas?.enable(
|
|
547
|
+
props.canvasElement.draggableObject,
|
|
548
|
+
{
|
|
549
|
+
quiet: true
|
|
550
|
+
}
|
|
551
|
+
);
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
props.canvasElement.draggableObject.connections.forEach(
|
|
555
|
+
(connection) => {
|
|
556
|
+
connection.enable();
|
|
557
|
+
connection.element.classList.remove('disabled');
|
|
558
|
+
if (connection.complementaryLineElement) {
|
|
559
|
+
connection.complementaryLineElement.classList.remove(
|
|
560
|
+
'disabled'
|
|
561
|
+
);
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
);
|
|
565
|
+
};
|
|
566
|
+
|
|
567
|
+
const handleCanvasConnectionStart = async (payload: any) => {
|
|
568
|
+
const selfAndAllChildren: UserManagedEntityState[] =
|
|
569
|
+
(await filterOutDuplicateEntitiesAsync([
|
|
570
|
+
props.entity,
|
|
571
|
+
...props.entity.inputs,
|
|
572
|
+
...props.entity.outputs,
|
|
573
|
+
...props.entity.internalCalls
|
|
574
|
+
])) as UserManagedEntityState[];
|
|
575
|
+
|
|
576
|
+
if (
|
|
577
|
+
selfAndAllChildren.some((ent) => payload.compatible?.[ent.id])
|
|
578
|
+
) {
|
|
579
|
+
setExpandedInputs(true);
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
if (!payload.compatible?.[props.entity.id]) {
|
|
583
|
+
props.project.canvas?.disable(
|
|
584
|
+
props.canvasElement.draggableObject,
|
|
585
|
+
{
|
|
586
|
+
quiet: true
|
|
587
|
+
}
|
|
588
|
+
);
|
|
589
|
+
|
|
590
|
+
const newOwnConnectionDisabledReasons: CanvasEntityConnectionDisabledReason[] =
|
|
591
|
+
payload.incompatible?.[props.entity.id]?.reasons || [];
|
|
592
|
+
|
|
593
|
+
setDisabledReasons((currentReasons) => {
|
|
594
|
+
const config = addDisabledReasons(
|
|
595
|
+
currentReasons,
|
|
596
|
+
newOwnConnectionDisabledReasons
|
|
597
|
+
);
|
|
598
|
+
return config.reasons;
|
|
599
|
+
});
|
|
600
|
+
} else {
|
|
601
|
+
forceUpdate();
|
|
602
|
+
}
|
|
603
|
+
};
|
|
604
|
+
|
|
605
|
+
const handleCanvasConnectionEnd = () => {
|
|
606
|
+
setExpandedInputs(false);
|
|
607
|
+
|
|
608
|
+
props.project.canvas?.enable(props.canvasElement.draggableObject, {
|
|
609
|
+
quiet: true
|
|
610
|
+
});
|
|
611
|
+
|
|
612
|
+
setDisabledReasons((currentReasons) => {
|
|
613
|
+
const config = removeDisabledReasons(
|
|
614
|
+
currentReasons,
|
|
615
|
+
ALL_CONNECTION_DISABLED_REASONS
|
|
616
|
+
);
|
|
617
|
+
return config.reasons;
|
|
618
|
+
});
|
|
619
|
+
};
|
|
620
|
+
|
|
621
|
+
const handleValueChange = (payload: any) => {
|
|
622
|
+
if (
|
|
623
|
+
payload?.owner?.id === props.entity?.id ||
|
|
624
|
+
payload?.owner?.id ===
|
|
625
|
+
(props.entity as VariableInstanceState)?.declaration?.id
|
|
626
|
+
) {
|
|
627
|
+
forceUpdate();
|
|
628
|
+
}
|
|
629
|
+
};
|
|
630
|
+
|
|
631
|
+
// --- Initial Setup Logic ---
|
|
632
|
+
const dataType = resolveDataType(props.entity);
|
|
633
|
+
const declaration = (props.entity as VariableInstanceState)
|
|
634
|
+
?.declaration;
|
|
635
|
+
|
|
636
|
+
const initialNewDisabledReasons: CanvasEntityOtherDisabledReason[] = [];
|
|
637
|
+
|
|
638
|
+
// @ts-ignore
|
|
639
|
+
if (props.entity.suggestion) {
|
|
640
|
+
initialNewDisabledReasons.push(
|
|
641
|
+
CanvasEntityOtherDisabledReason.Suggestion
|
|
642
|
+
);
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
if (props.project.canvas?.disabled) {
|
|
646
|
+
initialNewDisabledReasons.push(
|
|
647
|
+
CanvasEntityOtherDisabledReason.CanvasGloballyDisabled
|
|
648
|
+
);
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
if (!!initialNewDisabledReasons.length) {
|
|
652
|
+
setDisabledReasons((currentReasons) => {
|
|
653
|
+
const config = addDisabledReasons(
|
|
654
|
+
currentReasons,
|
|
655
|
+
initialNewDisabledReasons
|
|
656
|
+
);
|
|
657
|
+
return config.reasons;
|
|
658
|
+
});
|
|
659
|
+
} else {
|
|
660
|
+
setDisabledReasons((currentReasons) => {
|
|
661
|
+
const config = removeDisabledReasons(currentReasons, [
|
|
662
|
+
CanvasEntityOtherDisabledReason.CanvasGloballyDisabled
|
|
663
|
+
]);
|
|
664
|
+
return config.reasons;
|
|
665
|
+
});
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
if (dataType) {
|
|
669
|
+
props.project.on(dataType.id, handleForceUpdate);
|
|
670
|
+
}
|
|
671
|
+
if (declaration && declaration.id !== props.entity.id) {
|
|
672
|
+
props.project.on(declaration.id, handleForceUpdate);
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
props.project.on(
|
|
676
|
+
'canvas-globally-enabled',
|
|
677
|
+
handleCanvasGloballyEnabled
|
|
678
|
+
);
|
|
679
|
+
props.project.on(
|
|
680
|
+
'canvas-globally-disabled',
|
|
681
|
+
handleCanvasGloballyDisabled
|
|
682
|
+
);
|
|
683
|
+
props.project.on(props.entity.id, handleEntityUpdate);
|
|
684
|
+
props.project.on('test-setup-started', handleTestSetupStarted);
|
|
685
|
+
props.project.on('execution-start', handleExecutionStart);
|
|
686
|
+
props.project.on('test-exited', handleTestExited);
|
|
687
|
+
props.project.on(
|
|
688
|
+
'canvas-connection-start',
|
|
689
|
+
handleCanvasConnectionStart
|
|
690
|
+
);
|
|
691
|
+
props.project.on('canvas-connection-end', handleCanvasConnectionEnd);
|
|
692
|
+
props.project.on('value-written', handleValueChange);
|
|
693
|
+
props.project.on('value-removed', handleValueChange);
|
|
694
|
+
|
|
695
|
+
return () => {
|
|
696
|
+
if (dataType) {
|
|
697
|
+
props.project.off(dataType.id, handleForceUpdate);
|
|
698
|
+
}
|
|
699
|
+
if (declaration && declaration.id !== props.entity.id) {
|
|
700
|
+
props.project.off(declaration.id, handleForceUpdate);
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
props.project.off(
|
|
704
|
+
'canvas-globally-enabled',
|
|
705
|
+
handleCanvasGloballyEnabled
|
|
706
|
+
);
|
|
707
|
+
props.project.off(
|
|
708
|
+
'canvas-globally-disabled',
|
|
709
|
+
handleCanvasGloballyDisabled
|
|
710
|
+
);
|
|
711
|
+
props.project.off(props.entity.id, handleEntityUpdate);
|
|
712
|
+
props.project.off('test-setup-started', handleTestSetupStarted);
|
|
713
|
+
props.project.off('execution-start', handleExecutionStart);
|
|
714
|
+
props.project.off('test-exited', handleTestExited);
|
|
715
|
+
props.project.off(
|
|
716
|
+
'canvas-connection-start',
|
|
717
|
+
handleCanvasConnectionStart
|
|
718
|
+
);
|
|
719
|
+
props.project.off(
|
|
720
|
+
'canvas-connection-end',
|
|
721
|
+
handleCanvasConnectionEnd
|
|
722
|
+
);
|
|
723
|
+
props.project.off('value-written', handleValueChange);
|
|
724
|
+
props.project.off('value-removed', handleValueChange);
|
|
725
|
+
};
|
|
726
|
+
}, [
|
|
727
|
+
props.project,
|
|
728
|
+
props.entity,
|
|
729
|
+
props.canvasElement,
|
|
730
|
+
updateKey,
|
|
731
|
+
resolveDataType,
|
|
732
|
+
setExpandedInputs,
|
|
733
|
+
// @ts-ignore
|
|
734
|
+
props.entity.suggestion
|
|
735
|
+
]);
|
|
736
|
+
|
|
737
|
+
useEffect(() => {
|
|
738
|
+
props.canvasElement.draggableObject.updateConnections();
|
|
739
|
+
});
|
|
740
|
+
|
|
741
|
+
const entity: VariableState = props.entity;
|
|
742
|
+
|
|
743
|
+
const dataType = entity.getDataType(null);
|
|
744
|
+
|
|
745
|
+
// If there is any element unused, we need to show the button
|
|
746
|
+
const shouldShowExpandButton = !!entity.unusedInternalCalls.length;
|
|
747
|
+
// !!(
|
|
748
|
+
// !!entity.unusedInputs.length ||
|
|
749
|
+
// !!entity.unusedOutputs.length ||
|
|
750
|
+
// !!entity.unusedInternalCalls.length ||
|
|
751
|
+
// !entity.readsValue ||
|
|
752
|
+
// !entity.writesValues.length
|
|
753
|
+
// );
|
|
754
|
+
|
|
755
|
+
const isConnectionSourceDescendant: boolean = (() => {
|
|
756
|
+
if (
|
|
757
|
+
!props.project.onGoingConnectionSource ||
|
|
758
|
+
props.project.onGoingConnectionNodeType !==
|
|
759
|
+
ConnectionNodeType.PropertyOut
|
|
760
|
+
) {
|
|
761
|
+
return false;
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
const sourceEntity = props.project
|
|
765
|
+
.onGoingConnectionSource as ValueWritingEntityState;
|
|
766
|
+
|
|
767
|
+
const sourceCanvasParent: CanvasEntityState =
|
|
768
|
+
getParentCanvasEntity(sourceEntity);
|
|
769
|
+
|
|
770
|
+
if (sourceCanvasParent === entity) {
|
|
771
|
+
return true;
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
if (checkIsBranchDependentOnBranch(sourceCanvasParent, entity)) {
|
|
775
|
+
return true;
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
return false;
|
|
779
|
+
})();
|
|
780
|
+
|
|
781
|
+
// When a variable is being used to call a method of its instance, it cannot be called itself
|
|
782
|
+
const showNewInputButton = useMemo(
|
|
783
|
+
() =>
|
|
784
|
+
!props.project.test &&
|
|
785
|
+
(!dataType || dataType.canModifyObjectStructure()) &&
|
|
786
|
+
!disabledReasons.includes(
|
|
787
|
+
CanvasEntityOtherDisabledReason.CanvasGloballyDisabled
|
|
788
|
+
) &&
|
|
789
|
+
!disabledReasons.includes(
|
|
790
|
+
CanvasEntityOtherDisabledReason.Suggestion
|
|
791
|
+
) &&
|
|
792
|
+
!disabledReasons.includes(
|
|
793
|
+
CanvasEntityTestingDisabledReason.NotPartOfOngoingTest
|
|
794
|
+
) &&
|
|
795
|
+
!disabledReasons.includes(
|
|
796
|
+
CanvasEntityTestingDisabledReason.CannotBeAddedToTest
|
|
797
|
+
) &&
|
|
798
|
+
(!props.project.onGoingConnectionNodeType ||
|
|
799
|
+
(props.project.onGoingConnectionNodeType &&
|
|
800
|
+
props.project.onGoingConnectionNodeType ===
|
|
801
|
+
ConnectionNodeType.PropertyOut &&
|
|
802
|
+
!!props.project.onGoingConnectionSource &&
|
|
803
|
+
props.project.onGoingConnectionSource?.id !== entity.id &&
|
|
804
|
+
!isConnectionSourceDescendant)) &&
|
|
805
|
+
!disabledReasons.includes(
|
|
806
|
+
CanvasEntityConnectionDisabledReason.NotInScope
|
|
807
|
+
) &&
|
|
808
|
+
// If there is an active connection and the source is an ancestor that calls the current in its error branch,
|
|
809
|
+
// we shouldn't show the new inputs button
|
|
810
|
+
((): boolean => {
|
|
811
|
+
if (
|
|
812
|
+
!props.project.onGoingConnectionNodeType ||
|
|
813
|
+
props.project.onGoingConnectionNodeType !==
|
|
814
|
+
ConnectionNodeType.PropertyOut
|
|
815
|
+
) {
|
|
816
|
+
return true;
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
const sourceEntity = props.project
|
|
820
|
+
.onGoingConnectionSource as ValueWritingEntityState;
|
|
821
|
+
|
|
822
|
+
if (!sourceEntity) {
|
|
823
|
+
true;
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
const sourceCallerParent = getParentCallerEntity(sourceEntity);
|
|
827
|
+
|
|
828
|
+
const errorAcestors = flattenCallersWithCallType(entity).filter(
|
|
829
|
+
(a) => a.callType === 'error'
|
|
830
|
+
);
|
|
831
|
+
|
|
832
|
+
if (
|
|
833
|
+
errorAcestors.find(
|
|
834
|
+
(a) => a.caller?.id === sourceCallerParent?.id
|
|
835
|
+
)
|
|
836
|
+
) {
|
|
837
|
+
return false;
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
return true;
|
|
841
|
+
})(),
|
|
842
|
+
[
|
|
843
|
+
props.project,
|
|
844
|
+
props.project?.test,
|
|
845
|
+
entity,
|
|
846
|
+
disabledReasons,
|
|
847
|
+
updateKey,
|
|
848
|
+
props.project.onGoingConnectionNodeType
|
|
849
|
+
]
|
|
850
|
+
);
|
|
851
|
+
|
|
852
|
+
const resolvedUsedInputs = entity.usedInputs.filter((input) => {
|
|
853
|
+
if (inputOrOutputShouldBePartOfFinalVariableObjectValue(input)) {
|
|
854
|
+
return true;
|
|
855
|
+
}
|
|
856
|
+
return false;
|
|
857
|
+
});
|
|
858
|
+
const resolvedUsedOutputs = entity.usedOutputs.filter((output) => {
|
|
859
|
+
if (inputOrOutputShouldBePartOfFinalVariableObjectValue(output)) {
|
|
860
|
+
return true;
|
|
861
|
+
}
|
|
862
|
+
return false;
|
|
863
|
+
});
|
|
864
|
+
const resolvedUnusedInputs = entity.unusedInputs.filter((input) => {
|
|
865
|
+
if (inputOrOutputShouldBePartOfFinalVariableObjectValue(input)) {
|
|
866
|
+
return true;
|
|
867
|
+
}
|
|
868
|
+
return false;
|
|
869
|
+
});
|
|
870
|
+
const resolvedUnusedOutputs = entity.unusedOutputs.filter((output) => {
|
|
871
|
+
if (inputOrOutputShouldBePartOfFinalVariableObjectValue(output)) {
|
|
872
|
+
return true;
|
|
873
|
+
}
|
|
874
|
+
return false;
|
|
875
|
+
});
|
|
876
|
+
|
|
877
|
+
return (
|
|
878
|
+
<div
|
|
879
|
+
ref={rootElementRef}
|
|
880
|
+
className={['canvas-draggable-card'].join(' ')}
|
|
881
|
+
id={getCanvasEntityDOMId(props.entity)}
|
|
882
|
+
{...{
|
|
883
|
+
[Canvas.OBJ_ATTR_NAME]: getCanvasEntityDOMId(props.entity)
|
|
884
|
+
}}
|
|
885
|
+
onClick={(e) => {
|
|
886
|
+
e.stopPropagation();
|
|
887
|
+
}}
|
|
888
|
+
>
|
|
889
|
+
{/* When a variable is being used to call a method of its instance, it cannot be called itself */}
|
|
890
|
+
<TestEntityButton
|
|
891
|
+
entity={props.entity}
|
|
892
|
+
canvasElement={props.canvasElement}
|
|
893
|
+
project={props.project}
|
|
894
|
+
parentDisabledReasons={disabledReasons}
|
|
895
|
+
/>
|
|
896
|
+
<VariableScopeMarker
|
|
897
|
+
entity={entity}
|
|
898
|
+
project={props.project}
|
|
899
|
+
draggableObject={props.canvasElement.draggableObject}
|
|
900
|
+
parentDisabledReasons={disabledReasons}
|
|
901
|
+
/>
|
|
902
|
+
{/* Floats "Unreachable!" above the right side of the header when
|
|
903
|
+
the entity carries the blocked-reachability error. Same DOM
|
|
904
|
+
placement as VariableScopeMarker on VariableCard so the
|
|
905
|
+
`position: absolute` offsets resolve against the outer
|
|
906
|
+
canvas-draggable-card div. Returns null when reachable. */}
|
|
907
|
+
<UnreachableMarker
|
|
908
|
+
entity={props.entity}
|
|
909
|
+
parentDisabledReasons={disabledReasons}
|
|
910
|
+
project={props.project}
|
|
911
|
+
draggableObject={props.canvasElement.draggableObject}
|
|
912
|
+
/>
|
|
913
|
+
<div
|
|
914
|
+
className={[
|
|
915
|
+
'canvas-draggable-card__body',
|
|
916
|
+
...(!!disabledReasons.length
|
|
917
|
+
? ['canvas-draggable-card__body__disabled']
|
|
918
|
+
: []),
|
|
919
|
+
resolveEntityColorClass(props.entity.type, {
|
|
920
|
+
state: fromDisabledReasonsToCardState(disabledReasons)
|
|
921
|
+
})
|
|
922
|
+
].join(' ')}
|
|
923
|
+
>
|
|
924
|
+
<header
|
|
925
|
+
className="canvas-draggable-card__header"
|
|
926
|
+
{...{
|
|
927
|
+
[Canvas.OBJ_ATTR_NAME]:
|
|
928
|
+
getCanvasEntityDOMId(props.entity) + '--header'
|
|
929
|
+
}}
|
|
930
|
+
id={`${getCanvasEntityDOMId(props.entity)}--header`}
|
|
931
|
+
style={parse(
|
|
932
|
+
getCardGradientStatement(entity, {
|
|
933
|
+
state: fromDisabledReasonsToCardState(
|
|
934
|
+
disabledReasons
|
|
935
|
+
)
|
|
936
|
+
})
|
|
937
|
+
)}
|
|
938
|
+
onMouseOver={(e: any) => {
|
|
939
|
+
if (!!props.project.canvas?.activeConnectionDrawing) {
|
|
940
|
+
if (
|
|
941
|
+
!!props.project
|
|
942
|
+
.onGoingConnectionIncompatibleEntities?.[
|
|
943
|
+
props.entity.id
|
|
944
|
+
]
|
|
945
|
+
) {
|
|
946
|
+
// Read the disabled reasons and add a tooltip to the mouse
|
|
947
|
+
const reasonsMessage =
|
|
948
|
+
props.project.onGoingConnectionIncompatibleEntities?.[
|
|
949
|
+
props.entity.id
|
|
950
|
+
].reasons
|
|
951
|
+
.map((reason) =>
|
|
952
|
+
entityDisabledReasonToShortReadableError(
|
|
953
|
+
reason
|
|
954
|
+
)
|
|
955
|
+
)
|
|
956
|
+
.join('.\n');
|
|
957
|
+
|
|
958
|
+
props.project.canvas?.showTooltip(
|
|
959
|
+
'connection-disabled-reasons-test-entity-button',
|
|
960
|
+
reasonsMessage
|
|
961
|
+
);
|
|
962
|
+
if (props.project.canvas) {
|
|
963
|
+
props.project.canvas.tooltip.style.fontSize =
|
|
964
|
+
'28px';
|
|
965
|
+
props.project.canvas.canvasElement.style.cursor =
|
|
966
|
+
'not-allowed';
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
}}
|
|
971
|
+
onMouseLeave={(e: any) => {
|
|
972
|
+
props.project.canvas?.hideTooltip(
|
|
973
|
+
'connection-disabled-reasons-test-entity-button'
|
|
974
|
+
);
|
|
975
|
+
}}
|
|
976
|
+
>
|
|
977
|
+
<DynamicValueEntry
|
|
978
|
+
entity={props.entity}
|
|
979
|
+
project={props.project}
|
|
980
|
+
canvasElement={props.canvasElement}
|
|
981
|
+
parentDisabledReasons={disabledReasons}
|
|
982
|
+
>
|
|
983
|
+
{(extraContent) => (
|
|
984
|
+
<>
|
|
985
|
+
<div className="canvas-draggable-card__header__left-block">
|
|
986
|
+
<DataTypeIcon
|
|
987
|
+
entity={entity}
|
|
988
|
+
size="large"
|
|
989
|
+
parentDisabledReasons={disabledReasons}
|
|
990
|
+
project={props.project}
|
|
991
|
+
parentCanvasObject={
|
|
992
|
+
props.canvasElement?.draggableObject
|
|
993
|
+
}
|
|
994
|
+
/>
|
|
995
|
+
<span className="canvas-draggable-card__header__labels">
|
|
996
|
+
<div className="canvas-draggable-card__property__left-block canvas-draggable-card__property__value-container">
|
|
997
|
+
<span className="canvas-draggable-card__property__labels-group">
|
|
998
|
+
<h3>
|
|
999
|
+
{safeResolveEntityName(
|
|
1000
|
+
entity,
|
|
1001
|
+
props.project.logic
|
|
1002
|
+
)}
|
|
1003
|
+
</h3>
|
|
1004
|
+
{extraContent}
|
|
1005
|
+
</span>
|
|
1006
|
+
</div>
|
|
1007
|
+
</span>
|
|
1008
|
+
</div>
|
|
1009
|
+
<div className="canvas-draggable-card__header__actions">
|
|
1010
|
+
<EntityLockedIconMenu
|
|
1011
|
+
entity={entity}
|
|
1012
|
+
project={props.project}
|
|
1013
|
+
canvasElement={props.canvasElement}
|
|
1014
|
+
parentDisabledReasons={disabledReasons}
|
|
1015
|
+
/>
|
|
1016
|
+
<LogicErrorIconMenu
|
|
1017
|
+
entity={entity}
|
|
1018
|
+
project={props.project}
|
|
1019
|
+
canvasElement={props.canvasElement}
|
|
1020
|
+
parentDisabledReasons={disabledReasons}
|
|
1021
|
+
/>
|
|
1022
|
+
<Button
|
|
1023
|
+
variant="text"
|
|
1024
|
+
color="grey"
|
|
1025
|
+
iconEnd="fa-solid fa-ellipsis-v"
|
|
1026
|
+
size="small"
|
|
1027
|
+
ref={canvasPopup.anchorRef}
|
|
1028
|
+
className="canvas-small-entity-card-menu-button"
|
|
1029
|
+
id={`canvas-small-entity-card-menu-button-${entity.id}`}
|
|
1030
|
+
disabled={!!disabledReasons.length}
|
|
1031
|
+
onClick={(e: any) => {
|
|
1032
|
+
e.stopPropagation();
|
|
1033
|
+
canvasPopup?.toggle();
|
|
1034
|
+
}}
|
|
1035
|
+
onDoubleClick={(
|
|
1036
|
+
e: React.MouseEvent<HTMLButtonElement>
|
|
1037
|
+
) => {
|
|
1038
|
+
e.stopPropagation();
|
|
1039
|
+
if (disabledReasons.length) return;
|
|
1040
|
+
props.project?.canvas?.unselectAll();
|
|
1041
|
+
EditorService.navigate(
|
|
1042
|
+
`${props.project?.editorBasePath}/entity/${entity.type}/${props.entity.id}`
|
|
1043
|
+
);
|
|
1044
|
+
}}
|
|
1045
|
+
/>
|
|
1046
|
+
</div>
|
|
1047
|
+
</>
|
|
1048
|
+
)}
|
|
1049
|
+
</DynamicValueEntry>
|
|
1050
|
+
<SuccessFailureNodes
|
|
1051
|
+
entity={entity}
|
|
1052
|
+
draggableObject={props.canvasElement.draggableObject}
|
|
1053
|
+
project={props.project}
|
|
1054
|
+
parentDisabledReasons={disabledReasons}
|
|
1055
|
+
/>
|
|
1056
|
+
</header>
|
|
1057
|
+
<div className="canvas-draggable-card__content">
|
|
1058
|
+
{!!entity.error &&
|
|
1059
|
+
(expandedOutputs ||
|
|
1060
|
+
!!entity.error?.writesValues.length) && (
|
|
1061
|
+
<ErrorMapProperty
|
|
1062
|
+
outputMap={entity.error || null}
|
|
1063
|
+
entity={entity}
|
|
1064
|
+
draggableObject={
|
|
1065
|
+
props.canvasElement.draggableObject
|
|
1066
|
+
}
|
|
1067
|
+
project={props.project}
|
|
1068
|
+
parentDisabledReasons={disabledReasons}
|
|
1069
|
+
/>
|
|
1070
|
+
)}
|
|
1071
|
+
{shouldShowExpandButton && (
|
|
1072
|
+
<ExpandPropertiesIconButton
|
|
1073
|
+
project={props.project}
|
|
1074
|
+
expanded={expandedInputs}
|
|
1075
|
+
draggableObject={
|
|
1076
|
+
props.canvasElement.draggableObject
|
|
1077
|
+
}
|
|
1078
|
+
onClick={async () => {
|
|
1079
|
+
const errorDeclaration =
|
|
1080
|
+
getDeclarationOutputedError(entity);
|
|
1081
|
+
|
|
1082
|
+
// Create error output-map entity before expanding the error for the first time
|
|
1083
|
+
if (!entity.error) {
|
|
1084
|
+
let actionName =
|
|
1085
|
+
StateMutationAction.AddErrorOutputToVarInst;
|
|
1086
|
+
|
|
1087
|
+
if (
|
|
1088
|
+
entity.type ===
|
|
1089
|
+
EntityType.VariableDeclaration
|
|
1090
|
+
) {
|
|
1091
|
+
actionName =
|
|
1092
|
+
StateMutationAction.AddErrorOutputToVarDecl;
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
const changeSet =
|
|
1096
|
+
props.project.logic.addChangeSet(
|
|
1097
|
+
new ChangeSet(
|
|
1098
|
+
props.project.logic,
|
|
1099
|
+
ProjectState.sessionAuthor,
|
|
1100
|
+
new Date().toISOString(),
|
|
1101
|
+
entity,
|
|
1102
|
+
false,
|
|
1103
|
+
actionName
|
|
1104
|
+
)
|
|
1105
|
+
);
|
|
1106
|
+
|
|
1107
|
+
const newOutputMapTransfer: IActionOutputMapTransfer =
|
|
1108
|
+
OutputMapState.new(
|
|
1109
|
+
changeSet
|
|
1110
|
+
) as IActionOutputMapTransfer;
|
|
1111
|
+
newOutputMapTransfer.parent =
|
|
1112
|
+
entity.toReference();
|
|
1113
|
+
newOutputMapTransfer.declaration =
|
|
1114
|
+
(errorDeclaration?.toJSON() as IValueDescriptorTransfer) ||
|
|
1115
|
+
null;
|
|
1116
|
+
newOutputMapTransfer.parentRelationType =
|
|
1117
|
+
OutputMapParentChildRelation.Error;
|
|
1118
|
+
|
|
1119
|
+
const newInstance =
|
|
1120
|
+
createStateFromTypeAndSubscribe(
|
|
1121
|
+
newOutputMapTransfer,
|
|
1122
|
+
props.project.logic
|
|
1123
|
+
) as OutputMapState;
|
|
1124
|
+
|
|
1125
|
+
newInstance.hydrateAncestors();
|
|
1126
|
+
|
|
1127
|
+
newInstance.addSelfToProject(changeSet);
|
|
1128
|
+
|
|
1129
|
+
changeSet.add(
|
|
1130
|
+
newInstance,
|
|
1131
|
+
ChangeSetEntityChangeType.Added
|
|
1132
|
+
);
|
|
1133
|
+
|
|
1134
|
+
newInstance.initChildren(changeSet);
|
|
1135
|
+
|
|
1136
|
+
await props.project.renderAndCloseChangeSet(
|
|
1137
|
+
changeSet
|
|
1138
|
+
);
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
if (expandedInputs || expandedOutputs) {
|
|
1142
|
+
setExpandedOutputs(false);
|
|
1143
|
+
setExpandedInputs(false);
|
|
1144
|
+
} else {
|
|
1145
|
+
setExpandedOutputs(true);
|
|
1146
|
+
setExpandedInputs(true);
|
|
1147
|
+
}
|
|
1148
|
+
}}
|
|
1149
|
+
id={`expand-inputs-icon-button--${entity.id}`}
|
|
1150
|
+
tooltip={
|
|
1151
|
+
expandedInputs || expandedOutputs
|
|
1152
|
+
? 'Click to hide unused inputs and outputs'
|
|
1153
|
+
: 'Click to show unused inputs and outputs'
|
|
1154
|
+
}
|
|
1155
|
+
tooltipPlacement="top"
|
|
1156
|
+
style={{ marginTop: '6px' }}
|
|
1157
|
+
parentDisabledReasons={disabledReasons}
|
|
1158
|
+
/>
|
|
1159
|
+
)}
|
|
1160
|
+
|
|
1161
|
+
<MainValueInput
|
|
1162
|
+
entity={props.entity}
|
|
1163
|
+
canvasElement={props.canvasElement}
|
|
1164
|
+
project={props.project}
|
|
1165
|
+
parentDisabledReasons={disabledReasons}
|
|
1166
|
+
/>
|
|
1167
|
+
|
|
1168
|
+
<MainValueOutput
|
|
1169
|
+
entity={entity}
|
|
1170
|
+
canvasElement={props.canvasElement}
|
|
1171
|
+
project={props.project}
|
|
1172
|
+
parentDisabledReasons={disabledReasons}
|
|
1173
|
+
/>
|
|
1174
|
+
|
|
1175
|
+
{resolvedUnusedInputs.length > 0 && (
|
|
1176
|
+
<ul className="canvas-draggable-card__property-list">
|
|
1177
|
+
{resolvedUnusedInputs
|
|
1178
|
+
.sort((a, b) => {
|
|
1179
|
+
// Sort by `.index` property
|
|
1180
|
+
if (a.index < b.index) {
|
|
1181
|
+
return -1;
|
|
1182
|
+
}
|
|
1183
|
+
if (a.index > b.index) {
|
|
1184
|
+
return 1;
|
|
1185
|
+
}
|
|
1186
|
+
return 0;
|
|
1187
|
+
})
|
|
1188
|
+
.map((inputMap) => (
|
|
1189
|
+
<InputMapProperty
|
|
1190
|
+
key={inputMap.id}
|
|
1191
|
+
inputMap={inputMap}
|
|
1192
|
+
entity={props.entity}
|
|
1193
|
+
canvasElement={props.canvasElement}
|
|
1194
|
+
project={props.project}
|
|
1195
|
+
parentDisabledReasons={disabledReasons}
|
|
1196
|
+
/>
|
|
1197
|
+
))}
|
|
1198
|
+
</ul>
|
|
1199
|
+
)}
|
|
1200
|
+
|
|
1201
|
+
{resolvedUsedInputs.length > 0 && (
|
|
1202
|
+
<ul className="canvas-draggable-card__property-list">
|
|
1203
|
+
{resolvedUsedInputs
|
|
1204
|
+
.sort((a, b) => {
|
|
1205
|
+
// Sort by `.index` property
|
|
1206
|
+
if (a.index < b.index) {
|
|
1207
|
+
return -1;
|
|
1208
|
+
}
|
|
1209
|
+
if (a.index > b.index) {
|
|
1210
|
+
return 1;
|
|
1211
|
+
}
|
|
1212
|
+
return 0;
|
|
1213
|
+
})
|
|
1214
|
+
.map((inputMap) => (
|
|
1215
|
+
<InputMapProperty
|
|
1216
|
+
key={inputMap.id}
|
|
1217
|
+
inputMap={inputMap}
|
|
1218
|
+
entity={props.entity}
|
|
1219
|
+
canvasElement={props.canvasElement}
|
|
1220
|
+
project={props.project}
|
|
1221
|
+
parentDisabledReasons={disabledReasons}
|
|
1222
|
+
/>
|
|
1223
|
+
))}
|
|
1224
|
+
</ul>
|
|
1225
|
+
)}
|
|
1226
|
+
|
|
1227
|
+
{resolvedUsedOutputs.length > 0 && (
|
|
1228
|
+
<ul className="canvas-draggable-card__property-list">
|
|
1229
|
+
{resolvedUsedOutputs
|
|
1230
|
+
.sort((a, b) => {
|
|
1231
|
+
// Sort by `.index` property
|
|
1232
|
+
if (a.index < b.index) {
|
|
1233
|
+
return -1;
|
|
1234
|
+
}
|
|
1235
|
+
if (a.index > b.index) {
|
|
1236
|
+
return 1;
|
|
1237
|
+
}
|
|
1238
|
+
return 0;
|
|
1239
|
+
})
|
|
1240
|
+
.map((outputMap) => (
|
|
1241
|
+
<OutputMapProperty
|
|
1242
|
+
key={outputMap.id}
|
|
1243
|
+
outputMap={outputMap}
|
|
1244
|
+
entity={props.entity}
|
|
1245
|
+
canvasElement={props.canvasElement}
|
|
1246
|
+
project={props.project}
|
|
1247
|
+
parentDisabledReasons={disabledReasons}
|
|
1248
|
+
/>
|
|
1249
|
+
))}
|
|
1250
|
+
</ul>
|
|
1251
|
+
)}
|
|
1252
|
+
|
|
1253
|
+
{entity.usedInternalCalls.length > 0 && (
|
|
1254
|
+
<ul
|
|
1255
|
+
className={[
|
|
1256
|
+
'canvas-draggable-card__property-list',
|
|
1257
|
+
'canvas-draggable-card__property-list__align-right'
|
|
1258
|
+
].join(' ')}
|
|
1259
|
+
>
|
|
1260
|
+
{entity.usedInternalCalls
|
|
1261
|
+
.sort((a, b) => {
|
|
1262
|
+
// Sort by `.index` property
|
|
1263
|
+
if (a.index < b.index) {
|
|
1264
|
+
return -1;
|
|
1265
|
+
}
|
|
1266
|
+
if (a.index > b.index) {
|
|
1267
|
+
return 1;
|
|
1268
|
+
}
|
|
1269
|
+
return 0;
|
|
1270
|
+
})
|
|
1271
|
+
.map((call) => (
|
|
1272
|
+
<InternalCall
|
|
1273
|
+
key={call.id}
|
|
1274
|
+
call={call}
|
|
1275
|
+
entity={props.entity}
|
|
1276
|
+
canvasElement={props.canvasElement}
|
|
1277
|
+
project={props.project}
|
|
1278
|
+
parentDisabledReasons={disabledReasons}
|
|
1279
|
+
/>
|
|
1280
|
+
))}
|
|
1281
|
+
</ul>
|
|
1282
|
+
)}
|
|
1283
|
+
|
|
1284
|
+
{entity.unusedInternalCalls.length > 0 &&
|
|
1285
|
+
expandedInputs && (
|
|
1286
|
+
<ul
|
|
1287
|
+
className={[
|
|
1288
|
+
'canvas-draggable-card__property-list',
|
|
1289
|
+
'canvas-draggable-card__property-list__align-right'
|
|
1290
|
+
].join(' ')}
|
|
1291
|
+
>
|
|
1292
|
+
{entity.unusedInternalCalls
|
|
1293
|
+
.sort((a, b) => {
|
|
1294
|
+
// Sort by `.index` property
|
|
1295
|
+
if (a.index < b.index) {
|
|
1296
|
+
return -1;
|
|
1297
|
+
}
|
|
1298
|
+
if (a.index > b.index) {
|
|
1299
|
+
return 1;
|
|
1300
|
+
}
|
|
1301
|
+
return 0;
|
|
1302
|
+
})
|
|
1303
|
+
.map((call) => (
|
|
1304
|
+
<InternalCall
|
|
1305
|
+
key={call.id}
|
|
1306
|
+
call={call}
|
|
1307
|
+
entity={props.entity}
|
|
1308
|
+
canvasElement={props.canvasElement}
|
|
1309
|
+
project={props.project}
|
|
1310
|
+
parentDisabledReasons={
|
|
1311
|
+
disabledReasons
|
|
1312
|
+
}
|
|
1313
|
+
/>
|
|
1314
|
+
))}
|
|
1315
|
+
</ul>
|
|
1316
|
+
)}
|
|
1317
|
+
|
|
1318
|
+
{resolvedUnusedOutputs.length > 0 && (
|
|
1319
|
+
<ul className="canvas-draggable-card__property-list">
|
|
1320
|
+
{resolvedUnusedOutputs
|
|
1321
|
+
.sort((a, b) => {
|
|
1322
|
+
// Sort by `.index` property
|
|
1323
|
+
if (a.index < b.index) {
|
|
1324
|
+
return -1;
|
|
1325
|
+
}
|
|
1326
|
+
if (a.index > b.index) {
|
|
1327
|
+
return 1;
|
|
1328
|
+
}
|
|
1329
|
+
return 0;
|
|
1330
|
+
})
|
|
1331
|
+
.map((outputMap) => (
|
|
1332
|
+
<OutputMapProperty
|
|
1333
|
+
key={outputMap.id}
|
|
1334
|
+
outputMap={outputMap}
|
|
1335
|
+
entity={props.entity}
|
|
1336
|
+
canvasElement={props.canvasElement}
|
|
1337
|
+
project={props.project}
|
|
1338
|
+
parentDisabledReasons={disabledReasons}
|
|
1339
|
+
/>
|
|
1340
|
+
))}
|
|
1341
|
+
</ul>
|
|
1342
|
+
)}
|
|
1343
|
+
|
|
1344
|
+
{showNewInputButton && (
|
|
1345
|
+
<div
|
|
1346
|
+
className={[
|
|
1347
|
+
'canvas-draggable-card__action-alt',
|
|
1348
|
+
'align-left'
|
|
1349
|
+
].join(' ')}
|
|
1350
|
+
>
|
|
1351
|
+
<NewCardInputButton
|
|
1352
|
+
iconStart="fa-solid fa-plus"
|
|
1353
|
+
size="small"
|
|
1354
|
+
parentDisabledReasons={disabledReasons}
|
|
1355
|
+
entity={entity}
|
|
1356
|
+
project={props.project}
|
|
1357
|
+
canvasElement={props.canvasElement}
|
|
1358
|
+
onClick={() => {
|
|
1359
|
+
const variableDeclaration =
|
|
1360
|
+
getDeclaration(entity);
|
|
1361
|
+
|
|
1362
|
+
let actionName =
|
|
1363
|
+
StateMutationAction.AddPropertyToVarInst;
|
|
1364
|
+
|
|
1365
|
+
if (
|
|
1366
|
+
entity.type ===
|
|
1367
|
+
EntityType.VariableDeclaration
|
|
1368
|
+
) {
|
|
1369
|
+
actionName =
|
|
1370
|
+
StateMutationAction.AddPropertyToVarDecl;
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1373
|
+
const changeSet =
|
|
1374
|
+
props.project.logic.addChangeSet(
|
|
1375
|
+
new ChangeSet(
|
|
1376
|
+
props.project.logic,
|
|
1377
|
+
ProjectState.sessionAuthor,
|
|
1378
|
+
new Date().toISOString(),
|
|
1379
|
+
entity,
|
|
1380
|
+
false,
|
|
1381
|
+
actionName
|
|
1382
|
+
)
|
|
1383
|
+
);
|
|
1384
|
+
|
|
1385
|
+
let resolvedDataType: DataTypeState =
|
|
1386
|
+
dataType;
|
|
1387
|
+
let dataTypeEntity: DefinitionEntityState;
|
|
1388
|
+
|
|
1389
|
+
if (
|
|
1390
|
+
!!resolvedDataType.entity &&
|
|
1391
|
+
resolvedDataType.entity.type ===
|
|
1392
|
+
EntityType.DefinitionEntity &&
|
|
1393
|
+
resolvedDataType.entity.parent?.id ===
|
|
1394
|
+
resolvedDataType.id
|
|
1395
|
+
) {
|
|
1396
|
+
dataTypeEntity =
|
|
1397
|
+
resolvedDataType.entity as DefinitionEntityState;
|
|
1398
|
+
}
|
|
1399
|
+
|
|
1400
|
+
if (!resolvedDataType) {
|
|
1401
|
+
const newDataTypeTransfer =
|
|
1402
|
+
DataTypeState.new(changeSet);
|
|
1403
|
+
newDataTypeTransfer.parent =
|
|
1404
|
+
variableDeclaration.toReference();
|
|
1405
|
+
newDataTypeTransfer.inferred = true;
|
|
1406
|
+
|
|
1407
|
+
resolvedDataType =
|
|
1408
|
+
createStateFromTypeAndSubscribe(
|
|
1409
|
+
newDataTypeTransfer,
|
|
1410
|
+
props.project.logic
|
|
1411
|
+
) as DataTypeState;
|
|
1412
|
+
|
|
1413
|
+
resolvedDataType.hydrateAncestors();
|
|
1414
|
+
resolvedDataType.addSelfToProject(
|
|
1415
|
+
changeSet
|
|
1416
|
+
);
|
|
1417
|
+
changeSet.add(
|
|
1418
|
+
resolvedDataType,
|
|
1419
|
+
ChangeSetEntityChangeType.Added
|
|
1420
|
+
);
|
|
1421
|
+
resolvedDataType.initChildren(
|
|
1422
|
+
changeSet
|
|
1423
|
+
);
|
|
1424
|
+
}
|
|
1425
|
+
|
|
1426
|
+
if (!dataTypeEntity) {
|
|
1427
|
+
const newDefEntityTransfer =
|
|
1428
|
+
DefinitionEntityState.new(
|
|
1429
|
+
changeSet
|
|
1430
|
+
);
|
|
1431
|
+
const allOtherDefinitions =
|
|
1432
|
+
props.project.logic.getDefinitionEntities();
|
|
1433
|
+
|
|
1434
|
+
const desiredName =
|
|
1435
|
+
'Custom inline definition';
|
|
1436
|
+
|
|
1437
|
+
const newName = findNextAvailableName(
|
|
1438
|
+
desiredName,
|
|
1439
|
+
allOtherDefinitions
|
|
1440
|
+
);
|
|
1441
|
+
|
|
1442
|
+
newDefEntityTransfer.name = newName;
|
|
1443
|
+
newDefEntityTransfer.parent =
|
|
1444
|
+
resolvedDataType.toReference();
|
|
1445
|
+
|
|
1446
|
+
dataTypeEntity =
|
|
1447
|
+
createStateFromTypeAndSubscribe(
|
|
1448
|
+
newDefEntityTransfer,
|
|
1449
|
+
props.project.logic
|
|
1450
|
+
) as DefinitionEntityState;
|
|
1451
|
+
|
|
1452
|
+
dataTypeEntity.hydrateAncestors();
|
|
1453
|
+
dataTypeEntity.addSelfToProject(
|
|
1454
|
+
changeSet
|
|
1455
|
+
);
|
|
1456
|
+
changeSet.add(
|
|
1457
|
+
dataTypeEntity,
|
|
1458
|
+
ChangeSetEntityChangeType.Added
|
|
1459
|
+
);
|
|
1460
|
+
dataTypeEntity.initChildren(changeSet);
|
|
1461
|
+
resolvedDataType.setEntity(
|
|
1462
|
+
dataTypeEntity,
|
|
1463
|
+
changeSet
|
|
1464
|
+
);
|
|
1465
|
+
|
|
1466
|
+
changeSet.add(
|
|
1467
|
+
resolvedDataType,
|
|
1468
|
+
ChangeSetEntityChangeType.Updated
|
|
1469
|
+
);
|
|
1470
|
+
}
|
|
1471
|
+
|
|
1472
|
+
const newPropertyTransfer =
|
|
1473
|
+
PropertyState.new(changeSet);
|
|
1474
|
+
newPropertyTransfer.parent =
|
|
1475
|
+
dataTypeEntity.toReference();
|
|
1476
|
+
|
|
1477
|
+
newPropertyTransfer.name =
|
|
1478
|
+
findNextAvailableName(
|
|
1479
|
+
'Property',
|
|
1480
|
+
dataTypeEntity.properties
|
|
1481
|
+
);
|
|
1482
|
+
|
|
1483
|
+
const newProperty =
|
|
1484
|
+
createStateFromTypeAndSubscribe(
|
|
1485
|
+
newPropertyTransfer,
|
|
1486
|
+
props.project.logic
|
|
1487
|
+
) as PropertyState;
|
|
1488
|
+
|
|
1489
|
+
newProperty.hydrateAncestors();
|
|
1490
|
+
newProperty.addSelfToProject(changeSet);
|
|
1491
|
+
changeSet.add(
|
|
1492
|
+
newProperty,
|
|
1493
|
+
ChangeSetEntityChangeType.Added
|
|
1494
|
+
);
|
|
1495
|
+
newProperty.initChildren(changeSet);
|
|
1496
|
+
|
|
1497
|
+
const builtInPrimitiveStringEntity =
|
|
1498
|
+
props.project.logic.getBuiltIn(
|
|
1499
|
+
BUILT_IN_BASE_ENTITY_IDS[
|
|
1500
|
+
'primitive-entity'
|
|
1501
|
+
].string.id
|
|
1502
|
+
) as PrimitiveEntityState;
|
|
1503
|
+
|
|
1504
|
+
// Add 'string' data-type as default
|
|
1505
|
+
const dataTypeTransfer =
|
|
1506
|
+
DataTypeState.new(changeSet);
|
|
1507
|
+
dataTypeTransfer.parent =
|
|
1508
|
+
newProperty.toReference();
|
|
1509
|
+
dataTypeTransfer.entity =
|
|
1510
|
+
(builtInPrimitiveStringEntity?.toJSON() as IPrimitiveEntityTransfer) ||
|
|
1511
|
+
null;
|
|
1512
|
+
|
|
1513
|
+
const dataTypeInstance =
|
|
1514
|
+
createStateFromTypeAndSubscribe(
|
|
1515
|
+
dataTypeTransfer,
|
|
1516
|
+
props.project.logic
|
|
1517
|
+
) as DataTypeState;
|
|
1518
|
+
|
|
1519
|
+
dataTypeInstance.hydrateAncestors();
|
|
1520
|
+
dataTypeInstance.addSelfToProject(
|
|
1521
|
+
changeSet
|
|
1522
|
+
);
|
|
1523
|
+
changeSet.add(
|
|
1524
|
+
dataTypeInstance,
|
|
1525
|
+
ChangeSetEntityChangeType.Added
|
|
1526
|
+
);
|
|
1527
|
+
|
|
1528
|
+
dataTypeInstance.initChildren(changeSet);
|
|
1529
|
+
|
|
1530
|
+
const newEntityInputTransfer =
|
|
1531
|
+
VariableInputMapState.new(changeSet);
|
|
1532
|
+
newEntityInputTransfer.parent =
|
|
1533
|
+
entity.toReference();
|
|
1534
|
+
newEntityInputTransfer.declaration =
|
|
1535
|
+
newProperty.toJSON() as IPropertyTransfer;
|
|
1536
|
+
|
|
1537
|
+
const newEntityInput =
|
|
1538
|
+
createStateFromTypeAndSubscribe(
|
|
1539
|
+
newEntityInputTransfer,
|
|
1540
|
+
props.project.logic
|
|
1541
|
+
) as VariableInputMapState;
|
|
1542
|
+
|
|
1543
|
+
newEntityInput.hydrateAncestors();
|
|
1544
|
+
newEntityInput.addSelfToProject(changeSet);
|
|
1545
|
+
changeSet.add(
|
|
1546
|
+
newEntityInput,
|
|
1547
|
+
ChangeSetEntityChangeType.Added
|
|
1548
|
+
);
|
|
1549
|
+
newEntityInput.initChildren(changeSet);
|
|
1550
|
+
|
|
1551
|
+
dataType.metaSync(
|
|
1552
|
+
{
|
|
1553
|
+
inferred: false
|
|
1554
|
+
},
|
|
1555
|
+
changeSet
|
|
1556
|
+
);
|
|
1557
|
+
|
|
1558
|
+
EditorService.navigate(
|
|
1559
|
+
`${props.project?.editorBasePath}/entity/${newProperty.type}/${newProperty.id}`
|
|
1560
|
+
);
|
|
1561
|
+
|
|
1562
|
+
props.project.renderAndCloseChangeSet(
|
|
1563
|
+
changeSet
|
|
1564
|
+
);
|
|
1565
|
+
}}
|
|
1566
|
+
>
|
|
1567
|
+
Property
|
|
1568
|
+
</NewCardInputButton>
|
|
1569
|
+
</div>
|
|
1570
|
+
)}
|
|
1571
|
+
</div>
|
|
1572
|
+
</div>
|
|
1573
|
+
</div>
|
|
1574
|
+
);
|
|
1575
|
+
};
|
|
1576
|
+
|
|
1577
|
+
export default VariableCard;
|