@nocobase/flow-engine 2.0.0-alpha.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/LICENSE +661 -0
- package/README.md +30 -0
- package/lib/ContextPathProxy.d.ts +17 -0
- package/lib/ContextPathProxy.js +65 -0
- package/lib/ElementProxy.d.ts +17 -0
- package/lib/ElementProxy.js +93 -0
- package/lib/FlowContextProvider.d.ts +24 -0
- package/lib/FlowContextProvider.js +82 -0
- package/lib/FlowDefinition.d.ts +423 -0
- package/lib/FlowDefinition.js +257 -0
- package/lib/JSRunner.d.ts +32 -0
- package/lib/JSRunner.js +95 -0
- package/lib/ReactView.d.ts +20 -0
- package/lib/ReactView.js +120 -0
- package/lib/ViewScopedFlowEngine.d.ts +23 -0
- package/lib/ViewScopedFlowEngine.js +81 -0
- package/lib/acl/Acl.d.ts +31 -0
- package/lib/acl/Acl.js +115 -0
- package/lib/action-registry/BaseActionRegistry.d.ts +23 -0
- package/lib/action-registry/BaseActionRegistry.js +57 -0
- package/lib/action-registry/EngineActionRegistry.d.ts +20 -0
- package/lib/action-registry/EngineActionRegistry.js +47 -0
- package/lib/action-registry/ModelActionRegistry.d.ts +34 -0
- package/lib/action-registry/ModelActionRegistry.js +79 -0
- package/lib/components/DynamicFlowsEditor.d.ts +17 -0
- package/lib/components/DynamicFlowsEditor.js +49 -0
- package/lib/components/FieldModelRenderer.d.ts +10 -0
- package/lib/components/FieldModelRenderer.js +94 -0
- package/lib/components/FlowContextSelector.d.ts +11 -0
- package/lib/components/FlowContextSelector.js +221 -0
- package/lib/components/FlowErrorFallback.d.ts +25 -0
- package/lib/components/FlowErrorFallback.js +264 -0
- package/lib/components/FlowModelRenderer.d.ts +64 -0
- package/lib/components/FlowModelRenderer.js +254 -0
- package/lib/components/FormItem.d.ts +18 -0
- package/lib/components/FormItem.js +147 -0
- package/lib/components/common/FlowSettingsButton.d.ts +11 -0
- package/lib/components/common/FlowSettingsButton.js +66 -0
- package/lib/components/common/index.d.ts +9 -0
- package/lib/components/common/index.js +30 -0
- package/lib/components/common/withFlowDesignMode.d.ts +26 -0
- package/lib/components/common/withFlowDesignMode.js +61 -0
- package/lib/components/dnd/getMousePositionOnElement.d.ts +50 -0
- package/lib/components/dnd/getMousePositionOnElement.js +95 -0
- package/lib/components/dnd/index.d.ts +24 -0
- package/lib/components/dnd/index.js +164 -0
- package/lib/components/dnd/moveBlock.d.ts +33 -0
- package/lib/components/dnd/moveBlock.js +302 -0
- package/lib/components/index.d.ts +18 -0
- package/lib/components/index.js +48 -0
- package/lib/components/settings/independents/dropdown/FlowsDropdownButton.d.ts +46 -0
- package/lib/components/settings/independents/dropdown/FlowsDropdownButton.js +225 -0
- package/lib/components/settings/independents/dropdown/index.d.ts +9 -0
- package/lib/components/settings/independents/dropdown/index.js +30 -0
- package/lib/components/settings/independents/index.d.ts +1 -0
- package/lib/components/settings/independents/index.js +30 -0
- package/lib/components/settings/index.d.ts +10 -0
- package/lib/components/settings/index.js +32 -0
- package/lib/components/settings/wrappers/contextual/DefaultSettingsIcon.d.ts +24 -0
- package/lib/components/settings/wrappers/contextual/DefaultSettingsIcon.js +501 -0
- package/lib/components/settings/wrappers/contextual/FlowsContextMenu.d.ts +45 -0
- package/lib/components/settings/wrappers/contextual/FlowsContextMenu.js +231 -0
- package/lib/components/settings/wrappers/contextual/FlowsFloatContextMenu.d.ts +111 -0
- package/lib/components/settings/wrappers/contextual/FlowsFloatContextMenu.js +484 -0
- package/lib/components/settings/wrappers/contextual/StepRequiredSettingsDialog.d.ts +26 -0
- package/lib/components/settings/wrappers/contextual/StepRequiredSettingsDialog.js +342 -0
- package/lib/components/settings/wrappers/contextual/StepSettings.d.ts +23 -0
- package/lib/components/settings/wrappers/contextual/StepSettings.js +110 -0
- package/lib/components/settings/wrappers/contextual/StepSettingsDialog.d.ts +20 -0
- package/lib/components/settings/wrappers/contextual/StepSettingsDialog.js +206 -0
- package/lib/components/settings/wrappers/contextual/StepSettingsDrawer.d.ts +20 -0
- package/lib/components/settings/wrappers/contextual/StepSettingsDrawer.js +47 -0
- package/lib/components/settings/wrappers/contextual/index.d.ts +14 -0
- package/lib/components/settings/wrappers/contextual/index.js +40 -0
- package/lib/components/settings/wrappers/embedded/FlowSettings.d.ts +33 -0
- package/lib/components/settings/wrappers/embedded/FlowSettings.js +207 -0
- package/lib/components/settings/wrappers/embedded/FlowsSettings.d.ts +41 -0
- package/lib/components/settings/wrappers/embedded/FlowsSettings.js +84 -0
- package/lib/components/settings/wrappers/embedded/FlowsSettingsContent.d.ts +16 -0
- package/lib/components/settings/wrappers/embedded/FlowsSettingsContent.js +88 -0
- package/lib/components/settings/wrappers/embedded/index.d.ts +10 -0
- package/lib/components/settings/wrappers/embedded/index.js +32 -0
- package/lib/components/settings/wrappers/index.d.ts +2 -0
- package/lib/components/settings/wrappers/index.js +32 -0
- package/lib/components/subModel/AddSubModelButton.d.ts +62 -0
- package/lib/components/subModel/AddSubModelButton.js +415 -0
- package/lib/components/subModel/LazyDropdown.d.ts +55 -0
- package/lib/components/subModel/LazyDropdown.js +524 -0
- package/lib/components/subModel/index.d.ts +10 -0
- package/lib/components/subModel/index.js +32 -0
- package/lib/components/subModel/utils.d.ts +34 -0
- package/lib/components/subModel/utils.js +287 -0
- package/lib/components/variables/InlineVariableTag.d.ts +21 -0
- package/lib/components/variables/InlineVariableTag.js +123 -0
- package/lib/components/variables/SlateVariableEditor.d.ts +46 -0
- package/lib/components/variables/SlateVariableEditor.js +302 -0
- package/lib/components/variables/VariableInput.d.ts +11 -0
- package/lib/components/variables/VariableInput.js +322 -0
- package/lib/components/variables/VariableTag.d.ts +11 -0
- package/lib/components/variables/VariableTag.js +148 -0
- package/lib/components/variables/VariableTrigger.d.ts +20 -0
- package/lib/components/variables/VariableTrigger.js +136 -0
- package/lib/components/variables/index.d.ts +15 -0
- package/lib/components/variables/index.js +53 -0
- package/lib/components/variables/types.d.ts +93 -0
- package/lib/components/variables/types.js +24 -0
- package/lib/components/variables/useResolvedMetaTree.d.ts +19 -0
- package/lib/components/variables/useResolvedMetaTree.js +91 -0
- package/lib/components/variables/utils.d.ts +22 -0
- package/lib/components/variables/utils.js +177 -0
- package/lib/data-source/index.d.ts +180 -0
- package/lib/data-source/index.js +733 -0
- package/lib/data-source/jioToJoiSchema.d.ts +19 -0
- package/lib/data-source/jioToJoiSchema.js +114 -0
- package/lib/decorators/index.d.ts +9 -0
- package/lib/decorators/index.js +36 -0
- package/lib/decorators/largeField.d.ts +9 -0
- package/lib/decorators/largeField.js +42 -0
- package/lib/emitter.d.ts +16 -0
- package/lib/emitter.js +58 -0
- package/lib/event-registry/BaseEventRegistry.d.ts +22 -0
- package/lib/event-registry/BaseEventRegistry.js +57 -0
- package/lib/event-registry/EngineEventRegistry.d.ts +19 -0
- package/lib/event-registry/EngineEventRegistry.js +47 -0
- package/lib/event-registry/ModelEventRegistry.d.ts +33 -0
- package/lib/event-registry/ModelEventRegistry.js +79 -0
- package/lib/executor/FlowExecutor.d.ts +26 -0
- package/lib/executor/FlowExecutor.js +262 -0
- package/lib/flow-registry/BaseFlowRegistry.d.ts +46 -0
- package/lib/flow-registry/BaseFlowRegistry.js +86 -0
- package/lib/flow-registry/GlobalFlowRegistry.d.ts +22 -0
- package/lib/flow-registry/GlobalFlowRegistry.js +95 -0
- package/lib/flow-registry/InstanceFlowRegistry.d.ts +21 -0
- package/lib/flow-registry/InstanceFlowRegistry.js +59 -0
- package/lib/flow-registry/index.d.ts +11 -0
- package/lib/flow-registry/index.js +34 -0
- package/lib/flowContext.d.ts +215 -0
- package/lib/flowContext.js +1266 -0
- package/lib/flowEngine.d.ts +340 -0
- package/lib/flowEngine.js +781 -0
- package/lib/flowI18n.d.ts +46 -0
- package/lib/flowI18n.js +117 -0
- package/lib/flowSettings.d.ts +266 -0
- package/lib/flowSettings.js +850 -0
- package/lib/hooks/index.d.ts +14 -0
- package/lib/hooks/index.js +40 -0
- package/lib/hooks/useApplyAutoFlows.d.ts +21 -0
- package/lib/hooks/useApplyAutoFlows.js +62 -0
- package/lib/hooks/useFlowModel.d.ts +29 -0
- package/lib/hooks/useFlowModel.js +72 -0
- package/lib/hooks/useFlowModelById.d.ts +11 -0
- package/lib/hooks/useFlowModelById.js +61 -0
- package/lib/hooks/useFlowSettingsContext.d.ts +20 -0
- package/lib/hooks/useFlowSettingsContext.js +61 -0
- package/lib/hooks/useFlowStep.d.ts +17 -0
- package/lib/hooks/useFlowStep.js +56 -0
- package/lib/hooks/useNiceDropdownMaxHeight.d.ts +13 -0
- package/lib/hooks/useNiceDropdownMaxHeight.js +52 -0
- package/lib/index.d.ts +27 -0
- package/lib/index.js +73 -0
- package/lib/locale/en-US.json +61 -0
- package/lib/locale/index.d.ts +141 -0
- package/lib/locale/index.js +70 -0
- package/lib/locale/zh-CN.json +61 -0
- package/lib/models/CollectionFieldModel.d.ts +50 -0
- package/lib/models/CollectionFieldModel.js +242 -0
- package/lib/models/DisplayItemModel.d.ts +12 -0
- package/lib/models/DisplayItemModel.js +41 -0
- package/lib/models/EditableItemModel.d.ts +12 -0
- package/lib/models/EditableItemModel.js +41 -0
- package/lib/models/FilterableItemModel.d.ts +12 -0
- package/lib/models/FilterableItemModel.js +41 -0
- package/lib/models/flowModel.d.ts +344 -0
- package/lib/models/flowModel.js +1133 -0
- package/lib/models/forkFlowModel.d.ts +83 -0
- package/lib/models/forkFlowModel.js +257 -0
- package/lib/models/index.d.ts +14 -0
- package/lib/models/index.js +40 -0
- package/lib/provider.d.ts +22 -0
- package/lib/provider.js +114 -0
- package/lib/resources/apiResource.d.ts +34 -0
- package/lib/resources/apiResource.js +153 -0
- package/lib/resources/baseRecordResource.d.ts +61 -0
- package/lib/resources/baseRecordResource.js +264 -0
- package/lib/resources/filterItem.d.ts +33 -0
- package/lib/resources/filterItem.js +93 -0
- package/lib/resources/flowResource.d.ts +45 -0
- package/lib/resources/flowResource.js +146 -0
- package/lib/resources/index.d.ts +15 -0
- package/lib/resources/index.js +42 -0
- package/lib/resources/multiRecordResource.d.ts +53 -0
- package/lib/resources/multiRecordResource.js +230 -0
- package/lib/resources/singleRecordResource.d.ts +23 -0
- package/lib/resources/singleRecordResource.js +111 -0
- package/lib/resources/sqlResource.d.ts +73 -0
- package/lib/resources/sqlResource.js +294 -0
- package/lib/runjs-context/contexts/FlowRunJSContext.d.ts +38 -0
- package/lib/runjs-context/contexts/FlowRunJSContext.js +217 -0
- package/lib/runjs-context/contexts/FormJSFieldItemRunJSContext.d.ts +16 -0
- package/lib/runjs-context/contexts/FormJSFieldItemRunJSContext.js +66 -0
- package/lib/runjs-context/contexts/JSBlockRunJSContext.d.ts +16 -0
- package/lib/runjs-context/contexts/JSBlockRunJSContext.js +78 -0
- package/lib/runjs-context/contexts/JSCollectionActionRunJSContext.d.ts +12 -0
- package/lib/runjs-context/contexts/JSCollectionActionRunJSContext.js +59 -0
- package/lib/runjs-context/contexts/JSFieldRunJSContext.d.ts +16 -0
- package/lib/runjs-context/contexts/JSFieldRunJSContext.js +70 -0
- package/lib/runjs-context/contexts/JSItemRunJSContext.d.ts +16 -0
- package/lib/runjs-context/contexts/JSItemRunJSContext.js +66 -0
- package/lib/runjs-context/contexts/JSRecordActionRunJSContext.d.ts +12 -0
- package/lib/runjs-context/contexts/JSRecordActionRunJSContext.js +61 -0
- package/lib/runjs-context/contexts/LinkageRunJSContext.d.ts +12 -0
- package/lib/runjs-context/contexts/LinkageRunJSContext.js +62 -0
- package/lib/runjs-context/helpers.d.ts +17 -0
- package/lib/runjs-context/helpers.js +79 -0
- package/lib/runjs-context/index.d.ts +19 -0
- package/lib/runjs-context/index.js +57 -0
- package/lib/runjs-context/registry.d.ts +17 -0
- package/lib/runjs-context/registry.js +93 -0
- package/lib/runjs-context/snippets/global/api-request-get.snippet.d.ts +16 -0
- package/lib/runjs-context/snippets/global/api-request-get.snippet.js +42 -0
- package/lib/runjs-context/snippets/global/api-request-post.snippet.d.ts +16 -0
- package/lib/runjs-context/snippets/global/api-request-post.snippet.js +42 -0
- package/lib/runjs-context/snippets/global/console-log-ctx.snippet.d.ts +16 -0
- package/lib/runjs-context/snippets/global/console-log-ctx.snippet.js +41 -0
- package/lib/runjs-context/snippets/global/copy-record-json.snippet.d.ts +11 -0
- package/lib/runjs-context/snippets/global/copy-record-json.snippet.js +42 -0
- package/lib/runjs-context/snippets/global/copy-to-clipboard.snippet.d.ts +11 -0
- package/lib/runjs-context/snippets/global/copy-to-clipboard.snippet.js +42 -0
- package/lib/runjs-context/snippets/global/log-json-record.snippet.d.ts +11 -0
- package/lib/runjs-context/snippets/global/log-json-record.snippet.js +42 -0
- package/lib/runjs-context/snippets/global/message-error.snippet.d.ts +11 -0
- package/lib/runjs-context/snippets/global/message-error.snippet.js +41 -0
- package/lib/runjs-context/snippets/global/message-success.snippet.d.ts +11 -0
- package/lib/runjs-context/snippets/global/message-success.snippet.js +41 -0
- package/lib/runjs-context/snippets/global/notification-open.snippet.d.ts +16 -0
- package/lib/runjs-context/snippets/global/notification-open.snippet.js +43 -0
- package/lib/runjs-context/snippets/global/open-view-dialog.snippet.d.ts +11 -0
- package/lib/runjs-context/snippets/global/open-view-dialog.snippet.js +47 -0
- package/lib/runjs-context/snippets/global/open-view-drawer.snippet.d.ts +11 -0
- package/lib/runjs-context/snippets/global/open-view-drawer.snippet.js +47 -0
- package/lib/runjs-context/snippets/global/requireAsync.snippet.d.ts +16 -0
- package/lib/runjs-context/snippets/global/requireAsync.snippet.js +46 -0
- package/lib/runjs-context/snippets/global/sleep.snippet.d.ts +16 -0
- package/lib/runjs-context/snippets/global/sleep.snippet.js +43 -0
- package/lib/runjs-context/snippets/global/try-catch-async.snippet.d.ts +16 -0
- package/lib/runjs-context/snippets/global/try-catch-async.snippet.js +44 -0
- package/lib/runjs-context/snippets/global/view-navigation-push.snippet.d.ts +11 -0
- package/lib/runjs-context/snippets/global/view-navigation-push.snippet.js +44 -0
- package/lib/runjs-context/snippets/global/window-open.snippet.d.ts +16 -0
- package/lib/runjs-context/snippets/global/window-open.snippet.js +41 -0
- package/lib/runjs-context/snippets/index.d.ts +11 -0
- package/lib/runjs-context/snippets/index.js +94 -0
- package/lib/runjs-context/snippets/libs/echarts-init.snippet.d.ts +15 -0
- package/lib/runjs-context/snippets/libs/echarts-init.snippet.js +46 -0
- package/lib/runjs-context/snippets/scene/actions/collection-selected-count.snippet.d.ts +15 -0
- package/lib/runjs-context/snippets/scene/actions/collection-selected-count.snippet.js +44 -0
- package/lib/runjs-context/snippets/scene/actions/iterate-selected-rows.snippet.d.ts +15 -0
- package/lib/runjs-context/snippets/scene/actions/iterate-selected-rows.snippet.js +43 -0
- package/lib/runjs-context/snippets/scene/actions/record-id-message.snippet.d.ts +15 -0
- package/lib/runjs-context/snippets/scene/actions/record-id-message.snippet.js +43 -0
- package/lib/runjs-context/snippets/scene/actions/run-action-basic.snippet.d.ts +15 -0
- package/lib/runjs-context/snippets/scene/actions/run-action-basic.snippet.js +40 -0
- package/lib/runjs-context/snippets/scene/jsblock/add-event-listener.snippet.d.ts +15 -0
- package/lib/runjs-context/snippets/scene/jsblock/add-event-listener.snippet.js +46 -0
- package/lib/runjs-context/snippets/scene/jsblock/append-style.snippet.d.ts +15 -0
- package/lib/runjs-context/snippets/scene/jsblock/append-style.snippet.js +42 -0
- package/lib/runjs-context/snippets/scene/jsblock/jsx-mount.snippet.d.ts +15 -0
- package/lib/runjs-context/snippets/scene/jsblock/jsx-mount.snippet.js +46 -0
- package/lib/runjs-context/snippets/scene/jsblock/jsx-unmount.snippet.d.ts +15 -0
- package/lib/runjs-context/snippets/scene/jsblock/jsx-unmount.snippet.js +41 -0
- package/lib/runjs-context/snippets/scene/jsblock/render-basic.snippet.d.ts +15 -0
- package/lib/runjs-context/snippets/scene/jsblock/render-basic.snippet.js +41 -0
- package/lib/runjs-context/snippets/scene/jsblock/render-button-handler.snippet.d.ts +15 -0
- package/lib/runjs-context/snippets/scene/jsblock/render-button-handler.snippet.js +46 -0
- package/lib/runjs-context/snippets/scene/jsblock/render-card.snippet.d.ts +11 -0
- package/lib/runjs-context/snippets/scene/jsblock/render-card.snippet.js +45 -0
- package/lib/runjs-context/snippets/scene/jsblock/render-react.snippet.d.ts +15 -0
- package/lib/runjs-context/snippets/scene/jsblock/render-react.snippet.js +56 -0
- package/lib/runjs-context/snippets/scene/jsfield/color-by-value.snippet.d.ts +15 -0
- package/lib/runjs-context/snippets/scene/jsfield/color-by-value.snippet.js +42 -0
- package/lib/runjs-context/snippets/scene/jsfield/format-number.snippet.d.ts +15 -0
- package/lib/runjs-context/snippets/scene/jsfield/format-number.snippet.js +41 -0
- package/lib/runjs-context/snippets/scene/jsfield/innerHTML-value.snippet.d.ts +15 -0
- package/lib/runjs-context/snippets/scene/jsfield/innerHTML-value.snippet.js +40 -0
- package/lib/runjs-context/snippets/scene/jsitem/render-basic.snippet.d.ts +15 -0
- package/lib/runjs-context/snippets/scene/jsitem/render-basic.snippet.js +44 -0
- package/lib/runjs-context/snippets/scene/linkage/set-disabled.snippet.d.ts +15 -0
- package/lib/runjs-context/snippets/scene/linkage/set-disabled.snippet.js +60 -0
- package/lib/runjs-context/snippets/scene/linkage/set-field-value.snippet.d.ts +15 -0
- package/lib/runjs-context/snippets/scene/linkage/set-field-value.snippet.js +59 -0
- package/lib/runjs-context/snippets/scene/linkage/set-required.snippet.d.ts +15 -0
- package/lib/runjs-context/snippets/scene/linkage/set-required.snippet.js +60 -0
- package/lib/runjs-context/snippets/scene/linkage/toggle-visible.snippet.d.ts +15 -0
- package/lib/runjs-context/snippets/scene/linkage/toggle-visible.snippet.js +60 -0
- package/lib/runjs-context/snippets/types.d.ts +16 -0
- package/lib/runjs-context/snippets/types.js +24 -0
- package/lib/types.d.ts +398 -0
- package/lib/types.js +43 -0
- package/lib/utils/autoFlowError.d.ts +16 -0
- package/lib/utils/autoFlowError.js +53 -0
- package/lib/utils/constants.d.ts +29 -0
- package/lib/utils/constants.js +77 -0
- package/lib/utils/context.d.ts +40 -0
- package/lib/utils/context.js +63 -0
- package/lib/utils/createCollectionContextMeta.d.ts +11 -0
- package/lib/utils/createCollectionContextMeta.js +117 -0
- package/lib/utils/exceptions.d.ts +22 -0
- package/lib/utils/exceptions.js +62 -0
- package/lib/utils/flow-definitions.d.ts +11 -0
- package/lib/utils/flow-definitions.js +40 -0
- package/lib/utils/index.d.ts +22 -0
- package/lib/utils/index.js +117 -0
- package/lib/utils/inheritance.d.ts +16 -0
- package/lib/utils/inheritance.js +53 -0
- package/lib/utils/params-resolvers.d.ts +51 -0
- package/lib/utils/params-resolvers.js +309 -0
- package/lib/utils/parsePathnameToViewParams.d.ts +34 -0
- package/lib/utils/parsePathnameToViewParams.js +84 -0
- package/lib/utils/safeGlobals.d.ts +16 -0
- package/lib/utils/safeGlobals.js +179 -0
- package/lib/utils/schema-utils.d.ts +40 -0
- package/lib/utils/schema-utils.js +161 -0
- package/lib/utils/serverContextParams.d.ts +28 -0
- package/lib/utils/serverContextParams.js +106 -0
- package/lib/utils/setupRuntimeContextSteps.d.ts +19 -0
- package/lib/utils/setupRuntimeContextSteps.js +88 -0
- package/lib/utils/translation.d.ts +18 -0
- package/lib/utils/translation.js +58 -0
- package/lib/utils/variablesParams.d.ts +51 -0
- package/lib/utils/variablesParams.js +150 -0
- package/lib/views/DialogComponent.d.ts +22 -0
- package/lib/views/DialogComponent.js +98 -0
- package/lib/views/DrawerComponent.d.ts +11 -0
- package/lib/views/DrawerComponent.js +101 -0
- package/lib/views/FlowView.d.ts +76 -0
- package/lib/views/FlowView.js +81 -0
- package/lib/views/PageComponent.d.ts +10 -0
- package/lib/views/PageComponent.js +167 -0
- package/lib/views/ViewNavigation.d.ts +45 -0
- package/lib/views/ViewNavigation.js +97 -0
- package/lib/views/createViewMeta.d.ts +16 -0
- package/lib/views/createViewMeta.js +171 -0
- package/lib/views/index.d.ts +13 -0
- package/lib/views/index.js +48 -0
- package/lib/views/useDialog.d.ts +32 -0
- package/lib/views/useDialog.js +199 -0
- package/lib/views/useDrawer.d.ts +33 -0
- package/lib/views/useDrawer.js +206 -0
- package/lib/views/usePage.d.ts +32 -0
- package/lib/views/usePage.js +193 -0
- package/lib/views/usePatchElement.d.ts +10 -0
- package/lib/views/usePatchElement.js +54 -0
- package/lib/views/usePopover.d.ts +17 -0
- package/lib/views/usePopover.js +159 -0
- package/package.json +37 -0
- package/src/ContextPathProxy.ts +45 -0
- package/src/ElementProxy.ts +69 -0
- package/src/FlowContextProvider.tsx +40 -0
- package/src/FlowDefinition.ts +275 -0
- package/src/JSRunner.ts +84 -0
- package/src/ReactView.tsx +104 -0
- package/src/ViewScopedFlowEngine.ts +75 -0
- package/src/__tests__/ElementProxy.test.ts +51 -0
- package/src/__tests__/JSRunner.test.ts +92 -0
- package/src/__tests__/ReactView.test.tsx +63 -0
- package/src/__tests__/context-path-proxy.test.ts +35 -0
- package/src/__tests__/flow-engine.test.ts +189 -0
- package/src/__tests__/flowContext.test.ts +2012 -0
- package/src/__tests__/flowEngine.saveModel.test.ts +171 -0
- package/src/__tests__/flowI18n.test.ts +28 -0
- package/src/__tests__/flowModel.getFlows.test.ts +61 -0
- package/src/__tests__/flowModel.openView.navigation.test.ts +78 -0
- package/src/__tests__/flowRuntimeContext.test.ts +187 -0
- package/src/__tests__/flowSettings.open.test.tsx +1920 -0
- package/src/__tests__/flowSettings.test.ts +566 -0
- package/src/__tests__/globalFlowRegistry.test.ts +77 -0
- package/src/__tests__/isFieldInterfaceMatch.test.ts +51 -0
- package/src/__tests__/metaTreeNodeCache.test.ts +234 -0
- package/src/__tests__/path-aggregation.test.ts +85 -0
- package/src/__tests__/provider.test.tsx +28 -0
- package/src/__tests__/renderHiddenInConfig.test.tsx +91 -0
- package/src/__tests__/runjsContext.test.ts +60 -0
- package/src/__tests__/viewScopedFlowEngine.test.ts +212 -0
- package/src/acl/Acl.tsx +109 -0
- package/src/acl/__tests__/Acl.test.tsx +72 -0
- package/src/action-registry/BaseActionRegistry.ts +46 -0
- package/src/action-registry/EngineActionRegistry.ts +32 -0
- package/src/action-registry/ModelActionRegistry.ts +75 -0
- package/src/action-registry/__tests__/engineActionRegistry.test.ts +43 -0
- package/src/action-registry/__tests__/modelActionRegistry.test.ts +107 -0
- package/src/components/DynamicFlowsEditor.tsx +318 -0
- package/src/components/FieldModelRenderer.tsx +62 -0
- package/src/components/FlowContextSelector.tsx +255 -0
- package/src/components/FlowErrorFallback.tsx +316 -0
- package/src/components/FlowModelRenderer.tsx +428 -0
- package/src/components/FormItem.tsx +130 -0
- package/src/components/__tests__/flow-model-render-error-fallback.test.tsx +226 -0
- package/src/components/common/FlowSettingsButton.tsx +30 -0
- package/src/components/common/index.ts +10 -0
- package/src/components/common/withFlowDesignMode.tsx +49 -0
- package/src/components/dnd/getMousePositionOnElement.ts +115 -0
- package/src/components/dnd/index.tsx +128 -0
- package/src/components/dnd/moveBlock.ts +379 -0
- package/src/components/index.ts +20 -0
- package/src/components/settings/independents/dropdown/FlowsDropdownButton.tsx +279 -0
- package/src/components/settings/independents/dropdown/index.ts +10 -0
- package/src/components/settings/independents/index.ts +2 -0
- package/src/components/settings/index.ts +11 -0
- package/src/components/settings/wrappers/contextual/DefaultSettingsIcon.tsx +617 -0
- package/src/components/settings/wrappers/contextual/FlowsContextMenu.tsx +292 -0
- package/src/components/settings/wrappers/contextual/FlowsFloatContextMenu.tsx +655 -0
- package/src/components/settings/wrappers/contextual/StepRequiredSettingsDialog.tsx +446 -0
- package/src/components/settings/wrappers/contextual/StepSettings.tsx +109 -0
- package/src/components/settings/wrappers/contextual/StepSettingsDialog.tsx +217 -0
- package/src/components/settings/wrappers/contextual/StepSettingsDrawer.tsx +32 -0
- package/src/components/settings/wrappers/contextual/index.ts +15 -0
- package/src/components/settings/wrappers/embedded/FlowSettings.tsx +258 -0
- package/src/components/settings/wrappers/embedded/FlowsSettings.tsx +111 -0
- package/src/components/settings/wrappers/embedded/FlowsSettingsContent.tsx +96 -0
- package/src/components/settings/wrappers/embedded/index.ts +11 -0
- package/src/components/settings/wrappers/index.ts +5 -0
- package/src/components/subModel/AddSubModelButton.tsx +575 -0
- package/src/components/subModel/LazyDropdown.tsx +714 -0
- package/src/components/subModel/__tests__/AddSubModelButton.test.tsx +1185 -0
- package/src/components/subModel/__tests__/buildWrapperFieldChildren.test.ts +192 -0
- package/src/components/subModel/__tests__/utils.test.ts +425 -0
- package/src/components/subModel/index.ts +12 -0
- package/src/components/subModel/utils.ts +278 -0
- package/src/components/variables/InlineVariableTag.tsx +97 -0
- package/src/components/variables/SlateVariableEditor.tsx +384 -0
- package/src/components/variables/VariableInput.tsx +342 -0
- package/src/components/variables/VariableTag.tsx +123 -0
- package/src/components/variables/VariableTrigger.tsx +116 -0
- package/src/components/variables/__tests__/FlowContextSelector.test.tsx +553 -0
- package/src/components/variables/__tests__/VariableInput.test.tsx +550 -0
- package/src/components/variables/__tests__/VariableTag.test.tsx +347 -0
- package/src/components/variables/__tests__/test-utils.tsx +62 -0
- package/src/components/variables/__tests__/utils.test.ts +310 -0
- package/src/components/variables/index.ts +16 -0
- package/src/components/variables/types.ts +100 -0
- package/src/components/variables/useResolvedMetaTree.ts +76 -0
- package/src/components/variables/utils.ts +192 -0
- package/src/data-source/__tests__/collection.test.ts +58 -0
- package/src/data-source/__tests__/index.test.ts +82 -0
- package/src/data-source/__tests__/jioToJoiSchema.test.ts +56 -0
- package/src/data-source/index.ts +812 -0
- package/src/data-source/jioToJoiSchema.ts +103 -0
- package/src/decorators/index.ts +10 -0
- package/src/decorators/largeField.ts +14 -0
- package/src/emitter.ts +33 -0
- package/src/event-registry/BaseEventRegistry.ts +40 -0
- package/src/event-registry/EngineEventRegistry.ts +26 -0
- package/src/event-registry/ModelEventRegistry.ts +69 -0
- package/src/event-registry/__tests__/engineEventRegistry.test.ts +48 -0
- package/src/executor/FlowExecutor.ts +256 -0
- package/src/executor/__tests__/eventStep.test.ts +157 -0
- package/src/executor/__tests__/flowExecutor.test.ts +163 -0
- package/src/flow-registry/BaseFlowRegistry.ts +91 -0
- package/src/flow-registry/GlobalFlowRegistry.ts +82 -0
- package/src/flow-registry/InstanceFlowRegistry.ts +39 -0
- package/src/flow-registry/__tests__/globalFlowRegistry.test.ts +141 -0
- package/src/flow-registry/__tests__/instance-and-global-registry.test.ts +67 -0
- package/src/flow-registry/__tests__/instanceFlowRegistry.test.ts +83 -0
- package/src/flow-registry/index.ts +12 -0
- package/src/flowContext.ts +1639 -0
- package/src/flowEngine.ts +905 -0
- package/src/flowI18n.ts +96 -0
- package/src/flowSettings.ts +1045 -0
- package/src/hooks/index.ts +15 -0
- package/src/hooks/useApplyAutoFlows.ts +51 -0
- package/src/hooks/useFlowModel.tsx +59 -0
- package/src/hooks/useFlowModelById.ts +37 -0
- package/src/hooks/useFlowSettingsContext.tsx +37 -0
- package/src/hooks/useFlowStep.tsx +19 -0
- package/src/hooks/useNiceDropdownMaxHeight.ts +34 -0
- package/src/index.ts +38 -0
- package/src/locale/en-US.json +61 -0
- package/src/locale/index.ts +38 -0
- package/src/locale/zh-CN.json +61 -0
- package/src/models/CollectionFieldModel.tsx +269 -0
- package/src/models/DisplayItemModel.tsx +13 -0
- package/src/models/EditableItemModel.tsx +13 -0
- package/src/models/FilterableItemModel.tsx +13 -0
- package/src/models/__tests__/CollectionFieldModel.test.ts +122 -0
- package/src/models/__tests__/defaultParams-on-create.test.ts +83 -0
- package/src/models/__tests__/flow-model-oninit.test.ts +44 -0
- package/src/models/__tests__/flowModel.actions.integration.test.ts +100 -0
- package/src/models/__tests__/flowModel.getFlows.sort.test.ts +100 -0
- package/src/models/__tests__/flowModel.test.ts +2746 -0
- package/src/models/__tests__/flowRegistry.test.ts +512 -0
- package/src/models/__tests__/forkFlowModel.test.ts +1047 -0
- package/src/models/__tests__/model-actions.test.ts +70 -0
- package/src/models/__tests__/model-events.test.ts +69 -0
- package/src/models/flowModel.tsx +1398 -0
- package/src/models/forkFlowModel.ts +287 -0
- package/src/models/index.ts +17 -0
- package/src/provider.tsx +101 -0
- package/src/resources/__tests__/apiResource.test.ts +201 -0
- package/src/resources/__tests__/baseRecordResource.test.ts +262 -0
- package/src/resources/__tests__/filterItem.test.ts +260 -0
- package/src/resources/__tests__/flowResource.test.ts +127 -0
- package/src/resources/apiResource.ts +148 -0
- package/src/resources/baseRecordResource.ts +279 -0
- package/src/resources/filterItem.ts +74 -0
- package/src/resources/flowResource.ts +143 -0
- package/src/resources/index.ts +17 -0
- package/src/resources/multiRecordResource.ts +219 -0
- package/src/resources/singleRecordResource.ts +83 -0
- package/src/resources/sqlResource.ts +299 -0
- package/src/runjs-context/contexts/FlowRunJSContext.ts +190 -0
- package/src/runjs-context/contexts/FormJSFieldItemRunJSContext.ts +39 -0
- package/src/runjs-context/contexts/JSBlockRunJSContext.ts +52 -0
- package/src/runjs-context/contexts/JSCollectionActionRunJSContext.ts +32 -0
- package/src/runjs-context/contexts/JSFieldRunJSContext.ts +43 -0
- package/src/runjs-context/contexts/JSItemRunJSContext.ts +39 -0
- package/src/runjs-context/contexts/JSRecordActionRunJSContext.ts +34 -0
- package/src/runjs-context/contexts/LinkageRunJSContext.ts +35 -0
- package/src/runjs-context/helpers.ts +56 -0
- package/src/runjs-context/index.ts +20 -0
- package/src/runjs-context/registry.ts +65 -0
- package/src/runjs-context/snippets/global/api-request-get.snippet.ts +20 -0
- package/src/runjs-context/snippets/global/api-request-post.snippet.ts +20 -0
- package/src/runjs-context/snippets/global/console-log-ctx.snippet.ts +19 -0
- package/src/runjs-context/snippets/global/copy-record-json.snippet.ts +21 -0
- package/src/runjs-context/snippets/global/copy-to-clipboard.snippet.ts +21 -0
- package/src/runjs-context/snippets/global/log-json-record.snippet.ts +21 -0
- package/src/runjs-context/snippets/global/message-error.snippet.ts +20 -0
- package/src/runjs-context/snippets/global/message-success.snippet.ts +20 -0
- package/src/runjs-context/snippets/global/notification-open.snippet.ts +21 -0
- package/src/runjs-context/snippets/global/open-view-dialog.snippet.ts +26 -0
- package/src/runjs-context/snippets/global/open-view-drawer.snippet.ts +26 -0
- package/src/runjs-context/snippets/global/requireAsync.snippet.ts +24 -0
- package/src/runjs-context/snippets/global/sleep.snippet.ts +21 -0
- package/src/runjs-context/snippets/global/try-catch-async.snippet.ts +22 -0
- package/src/runjs-context/snippets/global/view-navigation-push.snippet.ts +23 -0
- package/src/runjs-context/snippets/global/window-open.snippet.ts +19 -0
- package/src/runjs-context/snippets/index.ts +59 -0
- package/src/runjs-context/snippets/libs/echarts-init.snippet.ts +24 -0
- package/src/runjs-context/snippets/scene/actions/collection-selected-count.snippet.ts +22 -0
- package/src/runjs-context/snippets/scene/actions/iterate-selected-rows.snippet.ts +21 -0
- package/src/runjs-context/snippets/scene/actions/record-id-message.snippet.ts +21 -0
- package/src/runjs-context/snippets/scene/actions/run-action-basic.snippet.ts +18 -0
- package/src/runjs-context/snippets/scene/jsblock/add-event-listener.snippet.ts +29 -0
- package/src/runjs-context/snippets/scene/jsblock/append-style.snippet.ts +20 -0
- package/src/runjs-context/snippets/scene/jsblock/jsx-mount.snippet.ts +24 -0
- package/src/runjs-context/snippets/scene/jsblock/jsx-unmount.snippet.ts +19 -0
- package/src/runjs-context/snippets/scene/jsblock/render-basic.snippet.ts +24 -0
- package/src/runjs-context/snippets/scene/jsblock/render-button-handler.snippet.ts +24 -0
- package/src/runjs-context/snippets/scene/jsblock/render-card.snippet.ts +30 -0
- package/src/runjs-context/snippets/scene/jsblock/render-react.snippet.ts +34 -0
- package/src/runjs-context/snippets/scene/jsfield/color-by-value.snippet.ts +20 -0
- package/src/runjs-context/snippets/scene/jsfield/format-number.snippet.ts +19 -0
- package/src/runjs-context/snippets/scene/jsfield/innerHTML-value.snippet.ts +18 -0
- package/src/runjs-context/snippets/scene/jsitem/render-basic.snippet.ts +27 -0
- package/src/runjs-context/snippets/scene/linkage/set-disabled.snippet.ts +38 -0
- package/src/runjs-context/snippets/scene/linkage/set-field-value.snippet.ts +37 -0
- package/src/runjs-context/snippets/scene/linkage/set-required.snippet.ts +38 -0
- package/src/runjs-context/snippets/scene/linkage/toggle-visible.snippet.ts +38 -0
- package/src/runjs-context/snippets/types.ts +17 -0
- package/src/types.ts +474 -0
- package/src/utils/__tests__/context.test.ts +93 -0
- package/src/utils/__tests__/params-resolvers.test.ts +652 -0
- package/src/utils/__tests__/parsePathnameToViewParams.test.ts +104 -0
- package/src/utils/__tests__/safeGlobals.test.ts +29 -0
- package/src/utils/__tests__/utils.test.ts +1021 -0
- package/src/utils/__tests__/variablesParams.test.ts +52 -0
- package/src/utils/autoFlowError.ts +29 -0
- package/src/utils/constants.ts +60 -0
- package/src/utils/context.ts +70 -0
- package/src/utils/createCollectionContextMeta.ts +122 -0
- package/src/utils/exceptions.ts +36 -0
- package/src/utils/flow-definitions.ts +16 -0
- package/src/utils/index.ts +63 -0
- package/src/utils/inheritance.ts +39 -0
- package/src/utils/params-resolvers.ts +482 -0
- package/src/utils/parsePathnameToViewParams.ts +103 -0
- package/src/utils/safeGlobals.ts +188 -0
- package/src/utils/schema-utils.ts +201 -0
- package/src/utils/serverContextParams.ts +111 -0
- package/src/utils/setupRuntimeContextSteps.ts +89 -0
- package/src/utils/translation.ts +37 -0
- package/src/utils/variablesParams.ts +175 -0
- package/src/views/DialogComponent.tsx +79 -0
- package/src/views/DrawerComponent.tsx +72 -0
- package/src/views/FlowView.tsx +103 -0
- package/src/views/PageComponent.tsx +150 -0
- package/src/views/ViewNavigation.ts +122 -0
- package/src/views/__tests__/FlowView.test.ts +31 -0
- package/src/views/__tests__/ViewNavigation.test.ts +191 -0
- package/src/views/__tests__/usePatchElement.test.tsx +28 -0
- package/src/views/createViewMeta.ts +157 -0
- package/src/views/index.tsx +14 -0
- package/src/views/useDialog.tsx +192 -0
- package/src/views/useDrawer.tsx +205 -0
- package/src/views/usePage.tsx +182 -0
- package/src/views/usePatchElement.tsx +27 -0
- package/src/views/usePopover.tsx +131 -0
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import type { FlowDefinitionOptions, StepDefinition } from './types';
|
|
10
|
+
import { IFlowRepository } from './flow-registry/BaseFlowRegistry';
|
|
11
|
+
export declare class FlowDefinition {
|
|
12
|
+
protected flowRegistry: IFlowRepository;
|
|
13
|
+
_steps: Map<string, FlowStep>;
|
|
14
|
+
protected options: Omit<FlowDefinitionOptions, 'steps'>;
|
|
15
|
+
constructor(options: FlowDefinitionOptions, flowRegistry: IFlowRepository);
|
|
16
|
+
get key(): string;
|
|
17
|
+
get title(): string;
|
|
18
|
+
set title(title: string);
|
|
19
|
+
get sort(): number;
|
|
20
|
+
get on(): import("./types").FlowEvent<import(".").FlowModel<import("./types").DefaultStructure>>;
|
|
21
|
+
set on(on: import("./types").FlowEvent<import(".").FlowModel<import("./types").DefaultStructure>>);
|
|
22
|
+
get defaultParams(): Record<string, any> | ((ctx: import("./flowContext").FlowModelContext) => {
|
|
23
|
+
[stepKey: string]: {
|
|
24
|
+
[paramKey: string]: any;
|
|
25
|
+
};
|
|
26
|
+
} | Promise<{
|
|
27
|
+
[stepKey: string]: {
|
|
28
|
+
[paramKey: string]: any;
|
|
29
|
+
};
|
|
30
|
+
}>);
|
|
31
|
+
get manual(): boolean;
|
|
32
|
+
set manual(manual: boolean);
|
|
33
|
+
get steps(): Record<string, StepDefinition<import(".").FlowModel<import("./types").DefaultStructure>>>;
|
|
34
|
+
getSortedSteps(): [string, FlowStep][];
|
|
35
|
+
setOptions(flowOptions: Omit<FlowDefinitionOptions, 'key' | 'steps'>): void;
|
|
36
|
+
getSteps(): Map<string, FlowStep>;
|
|
37
|
+
mapSteps(callback: (step: FlowStep) => any): any[];
|
|
38
|
+
getStep(stepKey: string): FlowStep;
|
|
39
|
+
addStep(stepKey: string, flowStep: Omit<StepDefinition, 'key'>): FlowStep;
|
|
40
|
+
setStep(stepKey: string, flowStep: StepDefinition): FlowStep;
|
|
41
|
+
hasStep(stepKey: string): boolean;
|
|
42
|
+
moveStep(sourceStepKey: string, targetStepKey: string): void;
|
|
43
|
+
removeStep(stepKey: string): void;
|
|
44
|
+
saveStep(step: FlowStep): Promise<void>;
|
|
45
|
+
destroyStep(stepKey: string): Promise<void>;
|
|
46
|
+
save(): Promise<void>;
|
|
47
|
+
destroy(): Promise<void>;
|
|
48
|
+
remove(): void;
|
|
49
|
+
toData(): any;
|
|
50
|
+
serialize(): any;
|
|
51
|
+
}
|
|
52
|
+
export declare class FlowStep {
|
|
53
|
+
protected flowDef: FlowDefinition;
|
|
54
|
+
protected options: StepDefinition;
|
|
55
|
+
constructor(options: StepDefinition, flowDef: FlowDefinition);
|
|
56
|
+
setOptions(stepOptions: Omit<StepDefinition, 'key' | 'flowKey'>): void;
|
|
57
|
+
get key(): string;
|
|
58
|
+
get flowKey(): string;
|
|
59
|
+
get title(): string;
|
|
60
|
+
set title(title: string);
|
|
61
|
+
get uiSchema(): Record<string, import("@formily/json-schema").Stringify<{
|
|
62
|
+
[key: symbol]: any;
|
|
63
|
+
[key: `x-${string}`]: any;
|
|
64
|
+
[key: `x-${number}`]: any;
|
|
65
|
+
version?: string;
|
|
66
|
+
name?: import("@formily/json-schema").SchemaKey;
|
|
67
|
+
title?: any;
|
|
68
|
+
description?: any;
|
|
69
|
+
default?: any;
|
|
70
|
+
readOnly?: boolean;
|
|
71
|
+
writeOnly?: boolean;
|
|
72
|
+
type?: import("@formily/json-schema").SchemaTypes;
|
|
73
|
+
enum?: import("@formily/json-schema").SchemaEnum<any>;
|
|
74
|
+
const?: any;
|
|
75
|
+
multipleOf?: number;
|
|
76
|
+
maximum?: number;
|
|
77
|
+
exclusiveMaximum?: number;
|
|
78
|
+
minimum?: number;
|
|
79
|
+
exclusiveMinimum?: number;
|
|
80
|
+
maxLength?: number;
|
|
81
|
+
minLength?: number;
|
|
82
|
+
pattern?: string | RegExp;
|
|
83
|
+
maxItems?: number;
|
|
84
|
+
minItems?: number;
|
|
85
|
+
uniqueItems?: boolean;
|
|
86
|
+
maxProperties?: number;
|
|
87
|
+
minProperties?: number;
|
|
88
|
+
required?: string | boolean | string[];
|
|
89
|
+
format?: string;
|
|
90
|
+
$ref?: string;
|
|
91
|
+
$namespace?: string;
|
|
92
|
+
definitions?: import("@formily/json-schema").SchemaProperties<any, any, any, any, any, any, any, any>;
|
|
93
|
+
properties?: import("@formily/json-schema").SchemaProperties<any, any, any, any, any, any, any, any>;
|
|
94
|
+
items?: import("@formily/json-schema").SchemaItems<any, any, any, any, any, any, any, any>;
|
|
95
|
+
additionalItems?: import("@formily/json-schema").Stringify<any>;
|
|
96
|
+
patternProperties?: import("@formily/json-schema").SchemaProperties<any, any, any, any, any, any, any, any>;
|
|
97
|
+
additionalProperties?: import("@formily/json-schema").Stringify<any>;
|
|
98
|
+
"x-value"?: any;
|
|
99
|
+
"x-index"?: number;
|
|
100
|
+
"x-pattern"?: any;
|
|
101
|
+
"x-display"?: any;
|
|
102
|
+
"x-validator"?: any;
|
|
103
|
+
"x-decorator"?: any;
|
|
104
|
+
"x-decorator-props"?: any;
|
|
105
|
+
"x-component"?: any;
|
|
106
|
+
"x-component-props"?: any;
|
|
107
|
+
"x-reactions"?: import("@formily/json-schema").SchemaReactions<any>;
|
|
108
|
+
"x-content"?: any;
|
|
109
|
+
"x-data"?: any;
|
|
110
|
+
"x-visible"?: boolean;
|
|
111
|
+
"x-hidden"?: boolean;
|
|
112
|
+
"x-disabled"?: boolean;
|
|
113
|
+
"x-editable"?: boolean;
|
|
114
|
+
"x-read-only"?: boolean;
|
|
115
|
+
"x-read-pretty"?: boolean;
|
|
116
|
+
"x-compile-omitted"?: string[];
|
|
117
|
+
}>> | ((ctx: import("./flowContext").FlowRuntimeContext<import(".").FlowModel<import("./types").DefaultStructure>, any>) => Record<string, import("@formily/json-schema").Stringify<{
|
|
118
|
+
[key: symbol]: any;
|
|
119
|
+
[key: `x-${string}`]: any;
|
|
120
|
+
[key: `x-${number}`]: any;
|
|
121
|
+
version?: string;
|
|
122
|
+
name?: import("@formily/json-schema").SchemaKey;
|
|
123
|
+
title?: any;
|
|
124
|
+
description?: any;
|
|
125
|
+
default?: any;
|
|
126
|
+
readOnly?: boolean;
|
|
127
|
+
writeOnly?: boolean;
|
|
128
|
+
type?: import("@formily/json-schema").SchemaTypes;
|
|
129
|
+
enum?: import("@formily/json-schema").SchemaEnum<any>;
|
|
130
|
+
const?: any;
|
|
131
|
+
multipleOf?: number;
|
|
132
|
+
maximum?: number;
|
|
133
|
+
exclusiveMaximum?: number;
|
|
134
|
+
minimum?: number;
|
|
135
|
+
exclusiveMinimum?: number;
|
|
136
|
+
maxLength?: number;
|
|
137
|
+
minLength?: number;
|
|
138
|
+
pattern?: string | RegExp;
|
|
139
|
+
maxItems?: number;
|
|
140
|
+
minItems?: number;
|
|
141
|
+
uniqueItems?: boolean;
|
|
142
|
+
maxProperties?: number;
|
|
143
|
+
minProperties?: number;
|
|
144
|
+
required?: string | boolean | string[];
|
|
145
|
+
format?: string;
|
|
146
|
+
$ref?: string;
|
|
147
|
+
$namespace?: string;
|
|
148
|
+
definitions?: import("@formily/json-schema").SchemaProperties<any, any, any, any, any, any, any, any>;
|
|
149
|
+
properties?: import("@formily/json-schema").SchemaProperties<any, any, any, any, any, any, any, any>;
|
|
150
|
+
items?: import("@formily/json-schema").SchemaItems<any, any, any, any, any, any, any, any>;
|
|
151
|
+
additionalItems?: import("@formily/json-schema").Stringify<any>;
|
|
152
|
+
patternProperties?: import("@formily/json-schema").SchemaProperties<any, any, any, any, any, any, any, any>;
|
|
153
|
+
additionalProperties?: import("@formily/json-schema").Stringify<any>;
|
|
154
|
+
"x-value"?: any;
|
|
155
|
+
"x-index"?: number;
|
|
156
|
+
"x-pattern"?: any;
|
|
157
|
+
"x-display"?: any;
|
|
158
|
+
"x-validator"?: any;
|
|
159
|
+
"x-decorator"?: any;
|
|
160
|
+
"x-decorator-props"?: any;
|
|
161
|
+
"x-component"?: any;
|
|
162
|
+
"x-component-props"?: any;
|
|
163
|
+
"x-reactions"?: import("@formily/json-schema").SchemaReactions<any>;
|
|
164
|
+
"x-content"?: any;
|
|
165
|
+
"x-data"?: any;
|
|
166
|
+
"x-visible"?: boolean;
|
|
167
|
+
"x-hidden"?: boolean;
|
|
168
|
+
"x-disabled"?: boolean;
|
|
169
|
+
"x-editable"?: boolean;
|
|
170
|
+
"x-read-only"?: boolean;
|
|
171
|
+
"x-read-pretty"?: boolean;
|
|
172
|
+
"x-compile-omitted"?: string[];
|
|
173
|
+
}>> | Promise<Record<string, import("@formily/json-schema").Stringify<{
|
|
174
|
+
[key: symbol]: any;
|
|
175
|
+
[key: `x-${string}`]: any;
|
|
176
|
+
[key: `x-${number}`]: any;
|
|
177
|
+
version?: string;
|
|
178
|
+
name?: import("@formily/json-schema").SchemaKey;
|
|
179
|
+
title?: any;
|
|
180
|
+
description?: any;
|
|
181
|
+
default?: any;
|
|
182
|
+
readOnly?: boolean;
|
|
183
|
+
writeOnly?: boolean;
|
|
184
|
+
type?: import("@formily/json-schema").SchemaTypes;
|
|
185
|
+
enum?: import("@formily/json-schema").SchemaEnum<any>;
|
|
186
|
+
const?: any;
|
|
187
|
+
multipleOf?: number;
|
|
188
|
+
maximum?: number;
|
|
189
|
+
exclusiveMaximum?: number;
|
|
190
|
+
minimum?: number;
|
|
191
|
+
exclusiveMinimum?: number;
|
|
192
|
+
maxLength?: number;
|
|
193
|
+
minLength?: number;
|
|
194
|
+
pattern?: string | RegExp;
|
|
195
|
+
maxItems?: number;
|
|
196
|
+
minItems?: number;
|
|
197
|
+
uniqueItems?: boolean;
|
|
198
|
+
maxProperties?: number;
|
|
199
|
+
minProperties?: number;
|
|
200
|
+
required?: string | boolean | string[];
|
|
201
|
+
format?: string;
|
|
202
|
+
$ref?: string;
|
|
203
|
+
$namespace?: string;
|
|
204
|
+
definitions?: import("@formily/json-schema").SchemaProperties<any, any, any, any, any, any, any, any>;
|
|
205
|
+
properties?: import("@formily/json-schema").SchemaProperties<any, any, any, any, any, any, any, any>;
|
|
206
|
+
items?: import("@formily/json-schema").SchemaItems<any, any, any, any, any, any, any, any>;
|
|
207
|
+
additionalItems?: import("@formily/json-schema").Stringify<any>;
|
|
208
|
+
patternProperties?: import("@formily/json-schema").SchemaProperties<any, any, any, any, any, any, any, any>;
|
|
209
|
+
additionalProperties?: import("@formily/json-schema").Stringify<any>;
|
|
210
|
+
"x-value"?: any;
|
|
211
|
+
"x-index"?: number;
|
|
212
|
+
"x-pattern"?: any;
|
|
213
|
+
"x-display"?: any;
|
|
214
|
+
"x-validator"?: any;
|
|
215
|
+
"x-decorator"?: any;
|
|
216
|
+
"x-decorator-props"?: any;
|
|
217
|
+
"x-component"?: any;
|
|
218
|
+
"x-component-props"?: any;
|
|
219
|
+
"x-reactions"?: import("@formily/json-schema").SchemaReactions<any>;
|
|
220
|
+
"x-content"?: any;
|
|
221
|
+
"x-data"?: any;
|
|
222
|
+
"x-visible"?: boolean;
|
|
223
|
+
"x-hidden"?: boolean;
|
|
224
|
+
"x-disabled"?: boolean;
|
|
225
|
+
"x-editable"?: boolean;
|
|
226
|
+
"x-read-only"?: boolean;
|
|
227
|
+
"x-read-pretty"?: boolean;
|
|
228
|
+
"x-compile-omitted"?: string[];
|
|
229
|
+
}>>>);
|
|
230
|
+
get defaultParams(): Record<string, any>;
|
|
231
|
+
set defaultParams(params: Record<string, any>);
|
|
232
|
+
get use(): string;
|
|
233
|
+
save(): Promise<void>;
|
|
234
|
+
remove(): Promise<void>;
|
|
235
|
+
destroy(): Promise<void>;
|
|
236
|
+
serialize(): {
|
|
237
|
+
flowKey: string;
|
|
238
|
+
key?: string;
|
|
239
|
+
isAwait?: boolean;
|
|
240
|
+
use?: string;
|
|
241
|
+
sort?: number;
|
|
242
|
+
preset?: boolean;
|
|
243
|
+
paramsRequired?: boolean;
|
|
244
|
+
hideInSettings?: boolean;
|
|
245
|
+
uiMode?: import("./types").StepUIMode | ((ctx: import("./flowContext").FlowRuntimeContext<import(".").FlowModel<import("./types").DefaultStructure>, any>) => import("./types").StepUIMode | Promise<import("./types").StepUIMode>);
|
|
246
|
+
title?: string;
|
|
247
|
+
defaultParams?: Record<string, any> | ((ctx: import("./flowContext").FlowRuntimeContext<import(".").FlowModel<import("./types").DefaultStructure>, any>) => Record<string, any> | Promise<Record<string, any>>);
|
|
248
|
+
handler?: (ctx: import("./flowContext").FlowRuntimeContext<import(".").FlowModel<import("./types").DefaultStructure>, any>, params: any) => any;
|
|
249
|
+
uiSchema?: Record<string, import("@formily/json-schema").Stringify<{
|
|
250
|
+
[key: symbol]: any;
|
|
251
|
+
[key: `x-${string}`]: any;
|
|
252
|
+
[key: `x-${number}`]: any;
|
|
253
|
+
version?: string;
|
|
254
|
+
name?: import("@formily/json-schema").SchemaKey;
|
|
255
|
+
title?: any;
|
|
256
|
+
description?: any;
|
|
257
|
+
default?: any;
|
|
258
|
+
readOnly?: boolean;
|
|
259
|
+
writeOnly?: boolean;
|
|
260
|
+
type?: import("@formily/json-schema").SchemaTypes;
|
|
261
|
+
enum?: import("@formily/json-schema").SchemaEnum<any>;
|
|
262
|
+
const?: any;
|
|
263
|
+
multipleOf?: number;
|
|
264
|
+
maximum?: number;
|
|
265
|
+
exclusiveMaximum?: number;
|
|
266
|
+
minimum?: number;
|
|
267
|
+
exclusiveMinimum?: number;
|
|
268
|
+
maxLength?: number;
|
|
269
|
+
minLength?: number;
|
|
270
|
+
pattern?: string | RegExp;
|
|
271
|
+
maxItems?: number;
|
|
272
|
+
minItems?: number;
|
|
273
|
+
uniqueItems?: boolean;
|
|
274
|
+
maxProperties?: number;
|
|
275
|
+
minProperties?: number;
|
|
276
|
+
required?: string | boolean | string[];
|
|
277
|
+
format?: string;
|
|
278
|
+
$ref?: string;
|
|
279
|
+
$namespace?: string;
|
|
280
|
+
definitions?: import("@formily/json-schema").SchemaProperties<any, any, any, any, any, any, any, any>;
|
|
281
|
+
properties?: import("@formily/json-schema").SchemaProperties<any, any, any, any, any, any, any, any>;
|
|
282
|
+
items?: import("@formily/json-schema").SchemaItems<any, any, any, any, any, any, any, any>;
|
|
283
|
+
additionalItems?: import("@formily/json-schema").Stringify<any>;
|
|
284
|
+
patternProperties?: import("@formily/json-schema").SchemaProperties<any, any, any, any, any, any, any, any>;
|
|
285
|
+
additionalProperties?: import("@formily/json-schema").Stringify<any>;
|
|
286
|
+
"x-value"?: any;
|
|
287
|
+
"x-index"?: number;
|
|
288
|
+
"x-pattern"?: any;
|
|
289
|
+
"x-display"?: any;
|
|
290
|
+
"x-validator"?: any;
|
|
291
|
+
"x-decorator"?: any;
|
|
292
|
+
"x-decorator-props"?: any;
|
|
293
|
+
"x-component"?: any;
|
|
294
|
+
"x-component-props"?: any;
|
|
295
|
+
"x-reactions"?: import("@formily/json-schema").SchemaReactions<any>;
|
|
296
|
+
"x-content"?: any;
|
|
297
|
+
"x-data"?: any;
|
|
298
|
+
"x-visible"?: boolean;
|
|
299
|
+
"x-hidden"?: boolean;
|
|
300
|
+
"x-disabled"?: boolean;
|
|
301
|
+
"x-editable"?: boolean;
|
|
302
|
+
"x-read-only"?: boolean;
|
|
303
|
+
"x-read-pretty"?: boolean;
|
|
304
|
+
"x-compile-omitted"?: string[];
|
|
305
|
+
}>> | ((ctx: import("./flowContext").FlowRuntimeContext<import(".").FlowModel<import("./types").DefaultStructure>, any>) => Record<string, import("@formily/json-schema").Stringify<{
|
|
306
|
+
[key: symbol]: any;
|
|
307
|
+
[key: `x-${string}`]: any;
|
|
308
|
+
[key: `x-${number}`]: any;
|
|
309
|
+
version?: string;
|
|
310
|
+
name?: import("@formily/json-schema").SchemaKey;
|
|
311
|
+
title?: any;
|
|
312
|
+
description?: any;
|
|
313
|
+
default?: any;
|
|
314
|
+
readOnly?: boolean;
|
|
315
|
+
writeOnly?: boolean;
|
|
316
|
+
type?: import("@formily/json-schema").SchemaTypes;
|
|
317
|
+
enum?: import("@formily/json-schema").SchemaEnum<any>;
|
|
318
|
+
const?: any;
|
|
319
|
+
multipleOf?: number;
|
|
320
|
+
maximum?: number;
|
|
321
|
+
exclusiveMaximum?: number;
|
|
322
|
+
minimum?: number;
|
|
323
|
+
exclusiveMinimum?: number;
|
|
324
|
+
maxLength?: number;
|
|
325
|
+
minLength?: number;
|
|
326
|
+
pattern?: string | RegExp;
|
|
327
|
+
maxItems?: number;
|
|
328
|
+
minItems?: number;
|
|
329
|
+
uniqueItems?: boolean;
|
|
330
|
+
maxProperties?: number;
|
|
331
|
+
minProperties?: number;
|
|
332
|
+
required?: string | boolean | string[];
|
|
333
|
+
format?: string;
|
|
334
|
+
$ref?: string;
|
|
335
|
+
$namespace?: string;
|
|
336
|
+
definitions?: import("@formily/json-schema").SchemaProperties<any, any, any, any, any, any, any, any>;
|
|
337
|
+
properties?: import("@formily/json-schema").SchemaProperties<any, any, any, any, any, any, any, any>;
|
|
338
|
+
items?: import("@formily/json-schema").SchemaItems<any, any, any, any, any, any, any, any>;
|
|
339
|
+
additionalItems?: import("@formily/json-schema").Stringify<any>;
|
|
340
|
+
patternProperties?: import("@formily/json-schema").SchemaProperties<any, any, any, any, any, any, any, any>;
|
|
341
|
+
additionalProperties?: import("@formily/json-schema").Stringify<any>;
|
|
342
|
+
"x-value"?: any;
|
|
343
|
+
"x-index"?: number;
|
|
344
|
+
"x-pattern"?: any;
|
|
345
|
+
"x-display"?: any;
|
|
346
|
+
"x-validator"?: any;
|
|
347
|
+
"x-decorator"?: any;
|
|
348
|
+
"x-decorator-props"?: any;
|
|
349
|
+
"x-component"?: any;
|
|
350
|
+
"x-component-props"?: any;
|
|
351
|
+
"x-reactions"?: import("@formily/json-schema").SchemaReactions<any>;
|
|
352
|
+
"x-content"?: any;
|
|
353
|
+
"x-data"?: any;
|
|
354
|
+
"x-visible"?: boolean;
|
|
355
|
+
"x-hidden"?: boolean;
|
|
356
|
+
"x-disabled"?: boolean;
|
|
357
|
+
"x-editable"?: boolean;
|
|
358
|
+
"x-read-only"?: boolean;
|
|
359
|
+
"x-read-pretty"?: boolean;
|
|
360
|
+
"x-compile-omitted"?: string[];
|
|
361
|
+
}>> | Promise<Record<string, import("@formily/json-schema").Stringify<{
|
|
362
|
+
[key: symbol]: any;
|
|
363
|
+
[key: `x-${string}`]: any;
|
|
364
|
+
[key: `x-${number}`]: any;
|
|
365
|
+
version?: string;
|
|
366
|
+
name?: import("@formily/json-schema").SchemaKey;
|
|
367
|
+
title?: any;
|
|
368
|
+
description?: any;
|
|
369
|
+
default?: any;
|
|
370
|
+
readOnly?: boolean;
|
|
371
|
+
writeOnly?: boolean;
|
|
372
|
+
type?: import("@formily/json-schema").SchemaTypes;
|
|
373
|
+
enum?: import("@formily/json-schema").SchemaEnum<any>;
|
|
374
|
+
const?: any;
|
|
375
|
+
multipleOf?: number;
|
|
376
|
+
maximum?: number;
|
|
377
|
+
exclusiveMaximum?: number;
|
|
378
|
+
minimum?: number;
|
|
379
|
+
exclusiveMinimum?: number;
|
|
380
|
+
maxLength?: number;
|
|
381
|
+
minLength?: number;
|
|
382
|
+
pattern?: string | RegExp;
|
|
383
|
+
maxItems?: number;
|
|
384
|
+
minItems?: number;
|
|
385
|
+
uniqueItems?: boolean;
|
|
386
|
+
maxProperties?: number;
|
|
387
|
+
minProperties?: number;
|
|
388
|
+
required?: string | boolean | string[];
|
|
389
|
+
format?: string;
|
|
390
|
+
$ref?: string;
|
|
391
|
+
$namespace?: string;
|
|
392
|
+
definitions?: import("@formily/json-schema").SchemaProperties<any, any, any, any, any, any, any, any>;
|
|
393
|
+
properties?: import("@formily/json-schema").SchemaProperties<any, any, any, any, any, any, any, any>;
|
|
394
|
+
items?: import("@formily/json-schema").SchemaItems<any, any, any, any, any, any, any, any>;
|
|
395
|
+
additionalItems?: import("@formily/json-schema").Stringify<any>;
|
|
396
|
+
patternProperties?: import("@formily/json-schema").SchemaProperties<any, any, any, any, any, any, any, any>;
|
|
397
|
+
additionalProperties?: import("@formily/json-schema").Stringify<any>;
|
|
398
|
+
"x-value"?: any;
|
|
399
|
+
"x-index"?: number;
|
|
400
|
+
"x-pattern"?: any;
|
|
401
|
+
"x-display"?: any;
|
|
402
|
+
"x-validator"?: any;
|
|
403
|
+
"x-decorator"?: any;
|
|
404
|
+
"x-decorator-props"?: any;
|
|
405
|
+
"x-component"?: any;
|
|
406
|
+
"x-component-props"?: any;
|
|
407
|
+
"x-reactions"?: import("@formily/json-schema").SchemaReactions<any>;
|
|
408
|
+
"x-content"?: any;
|
|
409
|
+
"x-data"?: any;
|
|
410
|
+
"x-visible"?: boolean;
|
|
411
|
+
"x-hidden"?: boolean;
|
|
412
|
+
"x-disabled"?: boolean;
|
|
413
|
+
"x-editable"?: boolean;
|
|
414
|
+
"x-read-only"?: boolean;
|
|
415
|
+
"x-read-pretty"?: boolean;
|
|
416
|
+
"x-compile-omitted"?: string[];
|
|
417
|
+
}>>>);
|
|
418
|
+
beforeParamsSave?: (ctx: import("./flowContext").FlowSettingsContext<import(".").FlowModel<import("./types").DefaultStructure>>, params: any, previousParams: any) => void | Promise<void>;
|
|
419
|
+
afterParamsSave?: (ctx: import("./flowContext").FlowSettingsContext<import(".").FlowModel<import("./types").DefaultStructure>>, params: any, previousParams: any) => void | Promise<void>;
|
|
420
|
+
useRawParams?: boolean | ((ctx: import("./flowContext").FlowRuntimeContext<import(".").FlowModel<import("./types").DefaultStructure>, any>) => boolean | Promise<boolean>);
|
|
421
|
+
scene?: import("./types").ActionScene | import("./types").ActionScene[];
|
|
422
|
+
};
|
|
423
|
+
}
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __create = Object.create;
|
|
11
|
+
var __defProp = Object.defineProperty;
|
|
12
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
15
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
17
|
+
var __export = (target, all) => {
|
|
18
|
+
for (var name in all)
|
|
19
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
20
|
+
};
|
|
21
|
+
var __copyProps = (to, from, except, desc) => {
|
|
22
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
23
|
+
for (let key of __getOwnPropNames(from))
|
|
24
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
25
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
26
|
+
}
|
|
27
|
+
return to;
|
|
28
|
+
};
|
|
29
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
30
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
31
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
32
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
33
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
34
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
35
|
+
mod
|
|
36
|
+
));
|
|
37
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
38
|
+
var FlowDefinition_exports = {};
|
|
39
|
+
__export(FlowDefinition_exports, {
|
|
40
|
+
FlowDefinition: () => FlowDefinition,
|
|
41
|
+
FlowStep: () => FlowStep
|
|
42
|
+
});
|
|
43
|
+
module.exports = __toCommonJS(FlowDefinition_exports);
|
|
44
|
+
var import_reactive = require("@formily/reactive");
|
|
45
|
+
var import_lodash = __toESM(require("lodash"));
|
|
46
|
+
const _FlowDefinition = class _FlowDefinition {
|
|
47
|
+
constructor(options, flowRegistry) {
|
|
48
|
+
this.flowRegistry = flowRegistry;
|
|
49
|
+
this.options = import_reactive.observable.shallow(import_lodash.default.omit(options, ["steps"]));
|
|
50
|
+
for (const [stepKey, step] of Object.entries(options.steps || {})) {
|
|
51
|
+
this.addStep(stepKey, step);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
_steps = import_reactive.observable.shallow(/* @__PURE__ */ new Map());
|
|
55
|
+
options;
|
|
56
|
+
get key() {
|
|
57
|
+
return this.options.key;
|
|
58
|
+
}
|
|
59
|
+
get title() {
|
|
60
|
+
return this.options.title;
|
|
61
|
+
}
|
|
62
|
+
set title(title) {
|
|
63
|
+
this.options.title = title;
|
|
64
|
+
}
|
|
65
|
+
get sort() {
|
|
66
|
+
return this.options.sort;
|
|
67
|
+
}
|
|
68
|
+
get on() {
|
|
69
|
+
return this.options.on;
|
|
70
|
+
}
|
|
71
|
+
set on(on) {
|
|
72
|
+
this.options.on = on;
|
|
73
|
+
}
|
|
74
|
+
get defaultParams() {
|
|
75
|
+
return this.options.defaultParams;
|
|
76
|
+
}
|
|
77
|
+
get manual() {
|
|
78
|
+
return this.options.manual;
|
|
79
|
+
}
|
|
80
|
+
set manual(manual) {
|
|
81
|
+
this.options.manual = manual;
|
|
82
|
+
}
|
|
83
|
+
get steps() {
|
|
84
|
+
const steps = {};
|
|
85
|
+
const sortedSteps = this.getSortedSteps();
|
|
86
|
+
for (const [stepKey, step] of sortedSteps) {
|
|
87
|
+
steps[stepKey] = step.serialize();
|
|
88
|
+
}
|
|
89
|
+
return steps;
|
|
90
|
+
}
|
|
91
|
+
getSortedSteps() {
|
|
92
|
+
return [...this._steps.entries()].sort(([, stepA], [, stepB]) => {
|
|
93
|
+
const sortA = stepA.serialize().sort ?? 0;
|
|
94
|
+
const sortB = stepB.serialize().sort ?? 0;
|
|
95
|
+
return sortA - sortB;
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
setOptions(flowOptions) {
|
|
99
|
+
Object.assign(this.options, flowOptions);
|
|
100
|
+
}
|
|
101
|
+
getSteps() {
|
|
102
|
+
return this._steps;
|
|
103
|
+
}
|
|
104
|
+
mapSteps(callback) {
|
|
105
|
+
const sortedSteps = this.getSortedSteps();
|
|
106
|
+
return sortedSteps.map(([, step]) => {
|
|
107
|
+
return callback(step);
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
getStep(stepKey) {
|
|
111
|
+
return this._steps.get(stepKey);
|
|
112
|
+
}
|
|
113
|
+
addStep(stepKey, flowStep) {
|
|
114
|
+
const existingStep = this._steps.get(stepKey);
|
|
115
|
+
if (existingStep) {
|
|
116
|
+
existingStep.setOptions(flowStep);
|
|
117
|
+
return existingStep;
|
|
118
|
+
} else {
|
|
119
|
+
if (flowStep.sort === void 0) {
|
|
120
|
+
const maxSort = Math.max(0, ...Array.from(this._steps.values()).map((step) => step.serialize().sort ?? 0));
|
|
121
|
+
flowStep = { ...flowStep, sort: maxSort + 1 };
|
|
122
|
+
}
|
|
123
|
+
const newStep = new FlowStep(
|
|
124
|
+
{
|
|
125
|
+
...flowStep,
|
|
126
|
+
key: stepKey
|
|
127
|
+
},
|
|
128
|
+
this
|
|
129
|
+
);
|
|
130
|
+
this._steps.set(stepKey, newStep);
|
|
131
|
+
return newStep;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
setStep(stepKey, flowStep) {
|
|
135
|
+
return this.addStep(stepKey, flowStep);
|
|
136
|
+
}
|
|
137
|
+
hasStep(stepKey) {
|
|
138
|
+
return this._steps.has(stepKey);
|
|
139
|
+
}
|
|
140
|
+
moveStep(sourceStepKey, targetStepKey) {
|
|
141
|
+
if (!this._steps.has(sourceStepKey)) {
|
|
142
|
+
throw new Error(`Source step '${sourceStepKey}' not found`);
|
|
143
|
+
}
|
|
144
|
+
if (!this._steps.has(targetStepKey)) {
|
|
145
|
+
throw new Error(`Target step '${targetStepKey}' not found`);
|
|
146
|
+
}
|
|
147
|
+
if (sourceStepKey === targetStepKey) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
const sortedSteps = this.getSortedSteps();
|
|
151
|
+
const newOrder = [];
|
|
152
|
+
const filteredSteps = sortedSteps.filter(([key]) => key !== sourceStepKey);
|
|
153
|
+
const sourceStep = this._steps.get(sourceStepKey);
|
|
154
|
+
for (const [stepKey, step] of filteredSteps) {
|
|
155
|
+
if (stepKey === targetStepKey) {
|
|
156
|
+
newOrder.push([sourceStepKey, sourceStep]);
|
|
157
|
+
}
|
|
158
|
+
newOrder.push([stepKey, step]);
|
|
159
|
+
}
|
|
160
|
+
newOrder.forEach(([stepKey, step], index) => {
|
|
161
|
+
step.setOptions({ sort: index + 1 });
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
removeStep(stepKey) {
|
|
165
|
+
this._steps.delete(stepKey);
|
|
166
|
+
}
|
|
167
|
+
async saveStep(step) {
|
|
168
|
+
await this.flowRegistry.saveFlow(this);
|
|
169
|
+
}
|
|
170
|
+
async destroyStep(stepKey) {
|
|
171
|
+
this.removeStep(stepKey);
|
|
172
|
+
await this.flowRegistry.saveFlow(this);
|
|
173
|
+
}
|
|
174
|
+
async save() {
|
|
175
|
+
await this.flowRegistry.saveFlow(this);
|
|
176
|
+
}
|
|
177
|
+
async destroy() {
|
|
178
|
+
await this.flowRegistry.destroyFlow(this.key);
|
|
179
|
+
}
|
|
180
|
+
remove() {
|
|
181
|
+
return this.flowRegistry.removeFlow(this.key);
|
|
182
|
+
}
|
|
183
|
+
toData() {
|
|
184
|
+
return this.serialize();
|
|
185
|
+
}
|
|
186
|
+
serialize() {
|
|
187
|
+
const data = {
|
|
188
|
+
...this.options
|
|
189
|
+
};
|
|
190
|
+
const sortedSteps = this.getSortedSteps();
|
|
191
|
+
for (const [stepKey, step] of sortedSteps) {
|
|
192
|
+
data.steps = data.steps || {};
|
|
193
|
+
data.steps[stepKey] = {
|
|
194
|
+
...step.serialize()
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
return data;
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
__name(_FlowDefinition, "FlowDefinition");
|
|
201
|
+
let FlowDefinition = _FlowDefinition;
|
|
202
|
+
const _FlowStep = class _FlowStep {
|
|
203
|
+
constructor(options, flowDef) {
|
|
204
|
+
this.flowDef = flowDef;
|
|
205
|
+
this.options = import_reactive.observable.shallow(options);
|
|
206
|
+
}
|
|
207
|
+
options;
|
|
208
|
+
setOptions(stepOptions) {
|
|
209
|
+
Object.assign(this.options, stepOptions);
|
|
210
|
+
}
|
|
211
|
+
get key() {
|
|
212
|
+
return this.options.key;
|
|
213
|
+
}
|
|
214
|
+
get flowKey() {
|
|
215
|
+
return this.flowDef.key;
|
|
216
|
+
}
|
|
217
|
+
get title() {
|
|
218
|
+
return this.options.title;
|
|
219
|
+
}
|
|
220
|
+
set title(title) {
|
|
221
|
+
this.options.title = title;
|
|
222
|
+
}
|
|
223
|
+
get uiSchema() {
|
|
224
|
+
return this.options.uiSchema;
|
|
225
|
+
}
|
|
226
|
+
get defaultParams() {
|
|
227
|
+
return this.options.defaultParams || {};
|
|
228
|
+
}
|
|
229
|
+
set defaultParams(params) {
|
|
230
|
+
this.options.defaultParams = params;
|
|
231
|
+
}
|
|
232
|
+
get use() {
|
|
233
|
+
return this.options.use;
|
|
234
|
+
}
|
|
235
|
+
async save() {
|
|
236
|
+
return this.flowDef.save();
|
|
237
|
+
}
|
|
238
|
+
async remove() {
|
|
239
|
+
return this.flowDef.removeStep(this.key);
|
|
240
|
+
}
|
|
241
|
+
async destroy() {
|
|
242
|
+
return this.flowDef.destroyStep(this.key);
|
|
243
|
+
}
|
|
244
|
+
serialize() {
|
|
245
|
+
return {
|
|
246
|
+
...this.options,
|
|
247
|
+
flowKey: this.flowDef.key
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
__name(_FlowStep, "FlowStep");
|
|
252
|
+
let FlowStep = _FlowStep;
|
|
253
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
254
|
+
0 && (module.exports = {
|
|
255
|
+
FlowDefinition,
|
|
256
|
+
FlowStep
|
|
257
|
+
});
|