@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
package/lib/types.d.ts
ADDED
|
@@ -0,0 +1,398 @@
|
|
|
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
|
+
/// <reference types="react" />
|
|
10
|
+
import { ISchema } from '@formily/json-schema';
|
|
11
|
+
import { SubModelItem } from './components';
|
|
12
|
+
import { FlowContext, FlowModelContext, FlowRuntimeContext, FlowSettingsContext } from './flowContext';
|
|
13
|
+
import type { FlowEngine } from './flowEngine';
|
|
14
|
+
import type { FlowModel } from './models';
|
|
15
|
+
/**
|
|
16
|
+
* 工具类型:如果 T 是数组类型,则提取数组元素类型;否则返回 T 本身
|
|
17
|
+
* @template T 要检查的类型
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* type Test1 = ArrayElementType<string[]>; // string
|
|
21
|
+
* type Test2 = ArrayElementType<number[]>; // number
|
|
22
|
+
* type Test3 = ArrayElementType<string>; // string
|
|
23
|
+
* type Test4 = ArrayElementType<{ id: number }[]>; // { id: number }
|
|
24
|
+
* type Test5 = ArrayElementType<{ id: number }>; // { id: number }
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export type ArrayElementType<T> = T extends (infer U)[] ? U : T;
|
|
28
|
+
export type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
29
|
+
export type DeepPartial<T> = {
|
|
30
|
+
[P in keyof T]?: T[P] extends (infer U)[] ? DeepPartial<U>[] : T[P] extends Record<string, any> ? DeepPartial<T[P]> : T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Defines a flow with generic model type support.
|
|
34
|
+
*/
|
|
35
|
+
export interface FlowDefinitionOptions<TModel extends FlowModel = FlowModel> {
|
|
36
|
+
/**
|
|
37
|
+
* Unique identifier for the flow.
|
|
38
|
+
* 建议采用统一的 xxxSettings 风格命名,例如:
|
|
39
|
+
* - pageSettings
|
|
40
|
+
* - tableSettings
|
|
41
|
+
* - cardSettings
|
|
42
|
+
* - formSettings
|
|
43
|
+
* - detailsSettings
|
|
44
|
+
* - buttonSettings
|
|
45
|
+
* - popupSettings
|
|
46
|
+
* - deleteSettings
|
|
47
|
+
* - datetimeSettings
|
|
48
|
+
* - numberSettings
|
|
49
|
+
* 这样命名便于识别和维护,建议全局统一。
|
|
50
|
+
* @example
|
|
51
|
+
* 'pageSettings'
|
|
52
|
+
* 'tableSettings'
|
|
53
|
+
* 'deleteSettings'
|
|
54
|
+
*/
|
|
55
|
+
key: string;
|
|
56
|
+
/**
|
|
57
|
+
* 人类可读的流标题,建议与 key 保持一致风格,采用 Xxx settings 命名,例如:
|
|
58
|
+
* - Page settings
|
|
59
|
+
* - Table settings
|
|
60
|
+
* - Card settings
|
|
61
|
+
* - Form settings
|
|
62
|
+
* - Details settings
|
|
63
|
+
* - Button settings
|
|
64
|
+
* - Popup settings
|
|
65
|
+
* - Delete settings
|
|
66
|
+
* - Datetime settings
|
|
67
|
+
* - Number settings
|
|
68
|
+
* 这样命名更清晰易懂,便于界面展示和团队协作。
|
|
69
|
+
* @example
|
|
70
|
+
* 'Page settings'
|
|
71
|
+
* 'Table settings'
|
|
72
|
+
* 'Delete settings'
|
|
73
|
+
*/
|
|
74
|
+
title?: string;
|
|
75
|
+
/**
|
|
76
|
+
* Whether this flow should be executed manually only (prevents auto-execution)
|
|
77
|
+
* Flows without 'on' property are auto-executed by default unless manual: true
|
|
78
|
+
*/
|
|
79
|
+
manual?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Sort order for flow execution, lower numbers execute first
|
|
82
|
+
* Defaults to 0, can be negative
|
|
83
|
+
*/
|
|
84
|
+
sort?: number;
|
|
85
|
+
/**
|
|
86
|
+
* 允许该 Flow 被 `dispatchEvent` 触发的事件配置。
|
|
87
|
+
* 仅用于声明触发事件名(字符串或 { eventName }),不包含处理函数。
|
|
88
|
+
*/
|
|
89
|
+
on?: FlowEvent<TModel>;
|
|
90
|
+
steps: Record<string, StepDefinition<TModel>>;
|
|
91
|
+
/**
|
|
92
|
+
* Flow 级默认参数:在模型实例化(createModel)时,为“当前 Flow”的步骤参数填充初始值。
|
|
93
|
+
* 仅填补缺失,不覆盖已有。固定返回形状:{ [stepKey]: params }
|
|
94
|
+
*/
|
|
95
|
+
defaultParams?: Record<string, any> | ((ctx: FlowModelContext) => StepParam | Promise<StepParam>);
|
|
96
|
+
}
|
|
97
|
+
export interface IModelComponentProps {
|
|
98
|
+
[key: string]: any;
|
|
99
|
+
}
|
|
100
|
+
export type ReadonlyModelProps = Readonly<IModelComponentProps>;
|
|
101
|
+
export type CreateSubModelOptions = CreateModelOptions | FlowModel;
|
|
102
|
+
/**
|
|
103
|
+
* Constructor for model classes.
|
|
104
|
+
*/
|
|
105
|
+
export type ModelConstructor<T extends FlowModel<any> = FlowModel<any>> = (new (options: FlowModelOptions<any>) => T) & {
|
|
106
|
+
meta?: FlowModelMeta;
|
|
107
|
+
};
|
|
108
|
+
export declare enum ActionScene {
|
|
109
|
+
/** 块级联动规则可用 */
|
|
110
|
+
BLOCK_LINKAGE_RULES = 1,
|
|
111
|
+
/** 表单字段级联动规则可用 */
|
|
112
|
+
FIELD_LINKAGE_RULES = 2,
|
|
113
|
+
/** 详情字段级联动规则可用 */
|
|
114
|
+
DETAILS_FIELD_LINKAGE_RULES = 3,
|
|
115
|
+
/** 按钮级联动规则可用 */
|
|
116
|
+
ACTION_LINKAGE_RULES = 4,
|
|
117
|
+
/** 动态事件流可用 */
|
|
118
|
+
DYNAMIC_EVENT_FLOW = 5
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Defines a reusable action with generic model type support.
|
|
122
|
+
*/
|
|
123
|
+
export interface ActionDefinition<TModel extends FlowModel = FlowModel, TCtx extends FlowContext = FlowContext> {
|
|
124
|
+
name: string;
|
|
125
|
+
title?: string;
|
|
126
|
+
handler: (ctx: TCtx, params: any) => Promise<any> | any;
|
|
127
|
+
uiSchema?: Record<string, ISchema> | ((ctx: TCtx) => Record<string, ISchema> | Promise<Record<string, ISchema>>);
|
|
128
|
+
defaultParams?: Record<string, any> | ((ctx: TCtx) => Record<string, any> | Promise<Record<string, any>>);
|
|
129
|
+
beforeParamsSave?: (ctx: FlowSettingsContext<TModel>, params: any, previousParams: any) => void | Promise<void>;
|
|
130
|
+
afterParamsSave?: (ctx: FlowSettingsContext<TModel>, params: any, previousParams: any) => void | Promise<void>;
|
|
131
|
+
useRawParams?: boolean | ((ctx: TCtx) => boolean | Promise<boolean>);
|
|
132
|
+
uiMode?: StepUIMode | ((ctx: FlowRuntimeContext<TModel>) => StepUIMode | Promise<StepUIMode>);
|
|
133
|
+
scene?: ActionScene | ActionScene[];
|
|
134
|
+
sort?: number;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Flow 事件名称集合。
|
|
138
|
+
* - 收录内置常用事件,便于智能提示;
|
|
139
|
+
* - 允许扩展字符串以保持向后兼容。
|
|
140
|
+
*/
|
|
141
|
+
export type FlowEventName = 'click' | 'submit' | 'reset' | 'remove' | 'openView' | 'dropdownOpen' | 'popupScroll' | 'search' | 'customRequest' | 'collapseToggle' | (string & {});
|
|
142
|
+
/**
|
|
143
|
+
* Flow 事件类型(供 FlowDefinitionOptions.on 使用)。
|
|
144
|
+
*/
|
|
145
|
+
export type FlowEvent<TModel extends FlowModel = FlowModel> = FlowEventName | {
|
|
146
|
+
eventName: FlowEventName;
|
|
147
|
+
defaultParams?: Record<string, any>;
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* 事件定义:用于事件注册表(全局/模型类级)。
|
|
151
|
+
*/
|
|
152
|
+
export type EventDefinition<TModel extends FlowModel = FlowModel, TCtx extends FlowContext = FlowContext> = ActionDefinition<TModel, TCtx>;
|
|
153
|
+
export type StepUIMode = 'dialog' | 'drawer' | 'embed' | {
|
|
154
|
+
type?: 'dialog' | 'drawer' | 'embed';
|
|
155
|
+
props?: Record<string, any>;
|
|
156
|
+
};
|
|
157
|
+
/**
|
|
158
|
+
* Step definition with unified support for both registered actions and inline handlers
|
|
159
|
+
* Extends ActionDefinition but makes some properties optional and adds step-specific properties
|
|
160
|
+
*/
|
|
161
|
+
export interface StepDefinition<TModel extends FlowModel = FlowModel> extends Partial<Omit<ActionDefinition<TModel, FlowRuntimeContext<TModel>>, 'name'>> {
|
|
162
|
+
key?: string;
|
|
163
|
+
isAwait?: boolean;
|
|
164
|
+
use?: string;
|
|
165
|
+
sort?: number;
|
|
166
|
+
preset?: boolean;
|
|
167
|
+
paramsRequired?: boolean;
|
|
168
|
+
hideInSettings?: boolean;
|
|
169
|
+
uiMode?: StepUIMode | ((ctx: FlowRuntimeContext<TModel>) => StepUIMode | Promise<StepUIMode>);
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Action options for registering actions with generic model type support
|
|
173
|
+
*/
|
|
174
|
+
export interface ActionOptions<TModel extends FlowModel = FlowModel, P = any, R = any> {
|
|
175
|
+
name: string;
|
|
176
|
+
handler: (ctx: FlowRuntimeContext<TModel>, params: P) => Promise<R> | R;
|
|
177
|
+
uiSchema?: Record<string, ISchema> | ((ctx: FlowRuntimeContext<TModel>) => Record<string, ISchema> | Promise<Record<string, ISchema>>);
|
|
178
|
+
defaultParams?: Partial<P> | ((ctx: FlowRuntimeContext<TModel>) => Partial<P> | Promise<Partial<P>>);
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Steps parameters structure for flow models
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
* ```typescript
|
|
185
|
+
* const stepParams: StepParams = {
|
|
186
|
+
* 'flow1': {
|
|
187
|
+
* 'step1': {
|
|
188
|
+
* 'param1': 'value1',
|
|
189
|
+
* 'param2': 'value2'
|
|
190
|
+
* },
|
|
191
|
+
* 'step2': {
|
|
192
|
+
* 'param3': 'value3'
|
|
193
|
+
* }
|
|
194
|
+
* },
|
|
195
|
+
* 'flow2': {
|
|
196
|
+
* 'step1': {
|
|
197
|
+
* 'param1': 'value1'
|
|
198
|
+
* }
|
|
199
|
+
* }
|
|
200
|
+
* }
|
|
201
|
+
* ```
|
|
202
|
+
*/
|
|
203
|
+
type StepParam = {
|
|
204
|
+
[stepKey: string]: {
|
|
205
|
+
[paramKey: string]: any;
|
|
206
|
+
};
|
|
207
|
+
};
|
|
208
|
+
export type StepParams = {
|
|
209
|
+
[flowKey: string]: StepParam;
|
|
210
|
+
};
|
|
211
|
+
export type ParamObject = {
|
|
212
|
+
[key: string]: unknown;
|
|
213
|
+
[key: number]: never;
|
|
214
|
+
};
|
|
215
|
+
/**
|
|
216
|
+
* 已注册模型的类名
|
|
217
|
+
*/
|
|
218
|
+
export type RegisteredModelClassName = string;
|
|
219
|
+
/**
|
|
220
|
+
* Options for creating a model instance
|
|
221
|
+
*/
|
|
222
|
+
export interface CreateModelOptions {
|
|
223
|
+
uid?: string;
|
|
224
|
+
use: RegisteredModelClassName | ModelConstructor;
|
|
225
|
+
props?: IModelComponentProps;
|
|
226
|
+
flowRegistry?: Record<string, Omit<FlowDefinitionOptions, 'key'>>;
|
|
227
|
+
stepParams?: StepParams;
|
|
228
|
+
subModels?: Record<string, CreateSubModelOptions | CreateSubModelOptions[]>;
|
|
229
|
+
parentId?: string;
|
|
230
|
+
subKey?: string;
|
|
231
|
+
subType?: 'object' | 'array';
|
|
232
|
+
sortIndex?: number;
|
|
233
|
+
delegateToParent?: boolean;
|
|
234
|
+
[key: string]: any;
|
|
235
|
+
}
|
|
236
|
+
export interface IFlowModelRepository<T extends FlowModel = FlowModel> {
|
|
237
|
+
findOne(query: Record<string, any>): Promise<Record<string, any> | null>;
|
|
238
|
+
save(model: T, options?: {
|
|
239
|
+
onlyStepParams?: boolean;
|
|
240
|
+
}): Promise<Record<string, any>>;
|
|
241
|
+
destroy(uid: string): Promise<boolean>;
|
|
242
|
+
move(sourceId: string, targetId: string, position: 'before' | 'after'): Promise<void>;
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* 步骤设置对话框的属性接口
|
|
246
|
+
*/
|
|
247
|
+
export interface StepSettingsDialogProps {
|
|
248
|
+
model: FlowModel;
|
|
249
|
+
flowKey: string;
|
|
250
|
+
stepKey: string;
|
|
251
|
+
dialogWidth?: number | string;
|
|
252
|
+
dialogTitle?: string;
|
|
253
|
+
mode?: 'dialog' | 'drawer';
|
|
254
|
+
ctx?: FlowRuntimeContext;
|
|
255
|
+
uiModeProps?: Record<string, any>;
|
|
256
|
+
cleanup?: () => void;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* 步骤设置抽屉的属性接口
|
|
260
|
+
*/
|
|
261
|
+
export interface StepSettingsDrawerProps {
|
|
262
|
+
model: FlowModel;
|
|
263
|
+
flowKey: string;
|
|
264
|
+
stepKey: string;
|
|
265
|
+
drawerWidth?: number | string;
|
|
266
|
+
drawerTitle?: string;
|
|
267
|
+
ctx?: FlowRuntimeContext;
|
|
268
|
+
uiModeProps?: Record<string, any>;
|
|
269
|
+
cleanup?: () => void;
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* 统一的步骤设置属性接口
|
|
273
|
+
*/
|
|
274
|
+
export interface StepSettingsProps {
|
|
275
|
+
model: FlowModel;
|
|
276
|
+
flowKey: string;
|
|
277
|
+
stepKey: string;
|
|
278
|
+
width?: number | string;
|
|
279
|
+
title?: string;
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* 分步表单对话框的属性接口
|
|
283
|
+
*/
|
|
284
|
+
export interface RequiredConfigStepFormDialogProps {
|
|
285
|
+
model: FlowModel;
|
|
286
|
+
dialogWidth?: number | string;
|
|
287
|
+
dialogTitle?: string;
|
|
288
|
+
}
|
|
289
|
+
export type SubModelValue<TModel extends FlowModel = FlowModel> = TModel | TModel[];
|
|
290
|
+
export interface DefaultStructure {
|
|
291
|
+
parent?: FlowModel;
|
|
292
|
+
subModels?: Record<string, FlowModel | FlowModel[]>;
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* 提取Structure中parent的类型,如果没有定义则使用FlowModel | null
|
|
296
|
+
*/
|
|
297
|
+
export type ParentFlowModel<Structure> = Structure extends {
|
|
298
|
+
parent: infer P;
|
|
299
|
+
} ? P : FlowModel | null;
|
|
300
|
+
/**
|
|
301
|
+
* Options for FlowModel constructor
|
|
302
|
+
*/
|
|
303
|
+
export interface FlowModelOptions<Structure extends {
|
|
304
|
+
parent?: FlowModel;
|
|
305
|
+
subModels?: any;
|
|
306
|
+
} = DefaultStructure> {
|
|
307
|
+
uid?: string;
|
|
308
|
+
use?: string;
|
|
309
|
+
async?: boolean;
|
|
310
|
+
props?: IModelComponentProps;
|
|
311
|
+
stepParams?: StepParams;
|
|
312
|
+
subModels?: Structure['subModels'];
|
|
313
|
+
flowRegistry?: Record<string, Omit<FlowDefinitionOptions, 'key'>>;
|
|
314
|
+
flowEngine?: FlowEngine;
|
|
315
|
+
parentId?: string;
|
|
316
|
+
delegateToParent?: boolean;
|
|
317
|
+
subKey?: string;
|
|
318
|
+
subType?: 'object' | 'array';
|
|
319
|
+
sortIndex?: number;
|
|
320
|
+
/**
|
|
321
|
+
* 是否启用“始终干净”的运行模式:
|
|
322
|
+
* - false:与传统模式一致(直接在 master 或当前 fork 上执行)。
|
|
323
|
+
*/
|
|
324
|
+
cleanRun?: boolean;
|
|
325
|
+
}
|
|
326
|
+
export type FlowModelMeta = Pick<SubModelItem, 'key' | 'label' | 'icon' | 'children' | 'useModel' | 'createModelOptions' | 'toggleable' | 'searchable' | 'searchPlaceholder'> & {
|
|
327
|
+
group?: string;
|
|
328
|
+
/**
|
|
329
|
+
* 菜单展示形态:
|
|
330
|
+
* - 'group':作为分组标题,子项平铺显示(默认)
|
|
331
|
+
* - 'submenu':作为可点击的一级项,展开二级子菜单
|
|
332
|
+
*/
|
|
333
|
+
menuType?: 'group' | 'submenu';
|
|
334
|
+
/**
|
|
335
|
+
* 排序权重,数字越小排序越靠前,用于控制显示顺序和默认选择
|
|
336
|
+
* 排序最靠前的将作为默认选择
|
|
337
|
+
* @default 0
|
|
338
|
+
*/
|
|
339
|
+
sort?: number;
|
|
340
|
+
/**
|
|
341
|
+
* 是否在菜单中隐藏该模型类
|
|
342
|
+
* @default false
|
|
343
|
+
*/
|
|
344
|
+
hide?: boolean;
|
|
345
|
+
eventList?: {
|
|
346
|
+
label: string;
|
|
347
|
+
value: string;
|
|
348
|
+
}[];
|
|
349
|
+
};
|
|
350
|
+
/**
|
|
351
|
+
* 字段 FlowModel 的专用元数据接口
|
|
352
|
+
* 继承自 FlowModelMeta,添加了字段接口相关的属性
|
|
353
|
+
*/
|
|
354
|
+
export interface FieldFlowModelMeta extends FlowModelMeta {
|
|
355
|
+
/**
|
|
356
|
+
* 支持的字段接口组列表,基于 CollectionFieldInterface 的 group 属性
|
|
357
|
+
* 如:['basic', 'choices', 'relation'] 等
|
|
358
|
+
* 如果不指定,则支持所有接口(向后兼容)
|
|
359
|
+
*/
|
|
360
|
+
supportedInterfaceGroups?: string[];
|
|
361
|
+
/**
|
|
362
|
+
* 支持的具体接口列表(可选,用于更精确的控制)
|
|
363
|
+
* 如:['input', 'textarea', 'select'] 等
|
|
364
|
+
*/
|
|
365
|
+
supportedInterfaces?: string[];
|
|
366
|
+
}
|
|
367
|
+
export type { ForkFlowModel } from './models';
|
|
368
|
+
/**
|
|
369
|
+
* 工具栏项目配置接口
|
|
370
|
+
*/
|
|
371
|
+
export interface ToolbarItemConfig {
|
|
372
|
+
/** 项目的唯一标识 */
|
|
373
|
+
key: string;
|
|
374
|
+
/** 项目组件,接收 model 作为 props,内部处理所有逻辑 */
|
|
375
|
+
component: React.ComponentType<{
|
|
376
|
+
model: FlowModel;
|
|
377
|
+
[key: string]: any;
|
|
378
|
+
}>;
|
|
379
|
+
/** 是否显示项目的条件函数 */
|
|
380
|
+
visible?: (model: FlowModel) => boolean;
|
|
381
|
+
/** 排序权重,数字越小越靠右(先添加的在右边) */
|
|
382
|
+
sort?: number;
|
|
383
|
+
}
|
|
384
|
+
export interface ApplyFlowCacheEntry {
|
|
385
|
+
status: 'pending' | 'resolved' | 'rejected';
|
|
386
|
+
promise: Promise<any>;
|
|
387
|
+
data?: any;
|
|
388
|
+
error?: any;
|
|
389
|
+
}
|
|
390
|
+
export interface PersistOptions {
|
|
391
|
+
/**
|
|
392
|
+
* 是否持久化(保存到数据库),默认为 true
|
|
393
|
+
*/
|
|
394
|
+
persist?: boolean;
|
|
395
|
+
}
|
|
396
|
+
export type ResourceType<T = any> = string | {
|
|
397
|
+
new (...args: any[]): T;
|
|
398
|
+
};
|
package/lib/types.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
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 __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
var types_exports = {};
|
|
28
|
+
__export(types_exports, {
|
|
29
|
+
ActionScene: () => ActionScene
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(types_exports);
|
|
32
|
+
var ActionScene = /* @__PURE__ */ ((ActionScene2) => {
|
|
33
|
+
ActionScene2[ActionScene2["BLOCK_LINKAGE_RULES"] = 1] = "BLOCK_LINKAGE_RULES";
|
|
34
|
+
ActionScene2[ActionScene2["FIELD_LINKAGE_RULES"] = 2] = "FIELD_LINKAGE_RULES";
|
|
35
|
+
ActionScene2[ActionScene2["DETAILS_FIELD_LINKAGE_RULES"] = 3] = "DETAILS_FIELD_LINKAGE_RULES";
|
|
36
|
+
ActionScene2[ActionScene2["ACTION_LINKAGE_RULES"] = 4] = "ACTION_LINKAGE_RULES";
|
|
37
|
+
ActionScene2[ActionScene2["DYNAMIC_EVENT_FLOW"] = 5] = "DYNAMIC_EVENT_FLOW";
|
|
38
|
+
return ActionScene2;
|
|
39
|
+
})(ActionScene || {});
|
|
40
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
41
|
+
0 && (module.exports = {
|
|
42
|
+
ActionScene
|
|
43
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
* Per-model AutoFlow error storage with proper typing, avoiding ad-hoc properties.
|
|
11
|
+
*/
|
|
12
|
+
import type { FlowModel } from '../models';
|
|
13
|
+
export type AutoFlowError = Error | null;
|
|
14
|
+
export declare function setAutoFlowError(model: FlowModel, err: AutoFlowError): void;
|
|
15
|
+
export declare function getAutoFlowError(model: FlowModel): AutoFlowError;
|
|
16
|
+
export declare function clearAutoFlowError(model: FlowModel): void;
|
|
@@ -0,0 +1,53 @@
|
|
|
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 __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
15
|
+
var __export = (target, all) => {
|
|
16
|
+
for (var name in all)
|
|
17
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
18
|
+
};
|
|
19
|
+
var __copyProps = (to, from, except, desc) => {
|
|
20
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
21
|
+
for (let key of __getOwnPropNames(from))
|
|
22
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
23
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
24
|
+
}
|
|
25
|
+
return to;
|
|
26
|
+
};
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var autoFlowError_exports = {};
|
|
29
|
+
__export(autoFlowError_exports, {
|
|
30
|
+
clearAutoFlowError: () => clearAutoFlowError,
|
|
31
|
+
getAutoFlowError: () => getAutoFlowError,
|
|
32
|
+
setAutoFlowError: () => setAutoFlowError
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(autoFlowError_exports);
|
|
35
|
+
const map = /* @__PURE__ */ new WeakMap();
|
|
36
|
+
function setAutoFlowError(model, err) {
|
|
37
|
+
map.set(model, err ?? null);
|
|
38
|
+
}
|
|
39
|
+
__name(setAutoFlowError, "setAutoFlowError");
|
|
40
|
+
function getAutoFlowError(model) {
|
|
41
|
+
return map.get(model) ?? null;
|
|
42
|
+
}
|
|
43
|
+
__name(getAutoFlowError, "getAutoFlowError");
|
|
44
|
+
function clearAutoFlowError(model) {
|
|
45
|
+
map.delete(model);
|
|
46
|
+
}
|
|
47
|
+
__name(clearAutoFlowError, "clearAutoFlowError");
|
|
48
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
49
|
+
0 && (module.exports = {
|
|
50
|
+
clearAutoFlowError,
|
|
51
|
+
getAutoFlowError,
|
|
52
|
+
setAutoFlowError
|
|
53
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
export declare const FLOW_ENGINE_NAMESPACE = "flow-engine";
|
|
10
|
+
export declare const BLOCK_TYPES: {
|
|
11
|
+
readonly DATA: "dataBlocks";
|
|
12
|
+
readonly FILTER: "filterBlocks";
|
|
13
|
+
readonly OTHER: "otherBlocks";
|
|
14
|
+
};
|
|
15
|
+
export interface BlockBuilderConfig {
|
|
16
|
+
key: string;
|
|
17
|
+
label: string;
|
|
18
|
+
type: 'group';
|
|
19
|
+
hasCurrentFlowContext?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare const BLOCK_GROUP_CONFIGS: Record<string, BlockBuilderConfig>;
|
|
22
|
+
export declare const SHOW_CURRENT_MODELS: string[];
|
|
23
|
+
export declare const MENU_KEYS: {
|
|
24
|
+
readonly CURRENT_RECORD: "currentRecord";
|
|
25
|
+
readonly ASSOCIATION_RECORDS: "associationRecords";
|
|
26
|
+
readonly OTHER_RECORDS: "otherRecords";
|
|
27
|
+
readonly OTHER_COLLECTIONS: "otherCollections";
|
|
28
|
+
readonly CURRENT_COLLECTIONS: "currentCollections";
|
|
29
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
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 __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
var constants_exports = {};
|
|
28
|
+
__export(constants_exports, {
|
|
29
|
+
BLOCK_GROUP_CONFIGS: () => BLOCK_GROUP_CONFIGS,
|
|
30
|
+
BLOCK_TYPES: () => BLOCK_TYPES,
|
|
31
|
+
FLOW_ENGINE_NAMESPACE: () => FLOW_ENGINE_NAMESPACE,
|
|
32
|
+
MENU_KEYS: () => MENU_KEYS,
|
|
33
|
+
SHOW_CURRENT_MODELS: () => SHOW_CURRENT_MODELS
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(constants_exports);
|
|
36
|
+
const FLOW_ENGINE_NAMESPACE = "flow-engine";
|
|
37
|
+
const BLOCK_TYPES = {
|
|
38
|
+
DATA: "dataBlocks",
|
|
39
|
+
FILTER: "filterBlocks",
|
|
40
|
+
OTHER: "otherBlocks"
|
|
41
|
+
};
|
|
42
|
+
const BLOCK_GROUP_CONFIGS = {
|
|
43
|
+
data: {
|
|
44
|
+
key: BLOCK_TYPES.DATA,
|
|
45
|
+
label: "Data blocks",
|
|
46
|
+
type: "group",
|
|
47
|
+
hasCurrentFlowContext: true
|
|
48
|
+
},
|
|
49
|
+
filter: {
|
|
50
|
+
key: BLOCK_TYPES.FILTER,
|
|
51
|
+
label: "Filter blocks",
|
|
52
|
+
type: "group",
|
|
53
|
+
hasCurrentFlowContext: false
|
|
54
|
+
},
|
|
55
|
+
other: {
|
|
56
|
+
key: BLOCK_TYPES.OTHER,
|
|
57
|
+
label: "Other blocks",
|
|
58
|
+
type: "group",
|
|
59
|
+
hasCurrentFlowContext: false
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
const SHOW_CURRENT_MODELS = ["EditFormModel", "DetailsBlockModel"];
|
|
63
|
+
const MENU_KEYS = {
|
|
64
|
+
CURRENT_RECORD: "currentRecord",
|
|
65
|
+
ASSOCIATION_RECORDS: "associationRecords",
|
|
66
|
+
OTHER_RECORDS: "otherRecords",
|
|
67
|
+
OTHER_COLLECTIONS: "otherCollections",
|
|
68
|
+
CURRENT_COLLECTIONS: "currentCollections"
|
|
69
|
+
};
|
|
70
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
71
|
+
0 && (module.exports = {
|
|
72
|
+
BLOCK_GROUP_CONFIGS,
|
|
73
|
+
BLOCK_TYPES,
|
|
74
|
+
FLOW_ENGINE_NAMESPACE,
|
|
75
|
+
MENU_KEYS,
|
|
76
|
+
SHOW_CURRENT_MODELS
|
|
77
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
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
|
+
* 解析变量表达式,提取属性路径
|
|
11
|
+
* 支持格式: "{{ ctx.user.name }}" => ["user", "name"]
|
|
12
|
+
* @param value 变量表达式字符串
|
|
13
|
+
* @returns 属性路径数组,解析失败返回 null
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* extractPropertyPath("{{ ctx.user.name }}") // ["user", "name"]
|
|
17
|
+
* extractPropertyPath("{{ ctx }}") // []
|
|
18
|
+
* extractPropertyPath("invalid") // null
|
|
19
|
+
*/
|
|
20
|
+
export declare function extractPropertyPath(value: string): string[] | null;
|
|
21
|
+
/**
|
|
22
|
+
* 格式化属性路径为变量表达式
|
|
23
|
+
* @param path 属性路径数组
|
|
24
|
+
* @returns 变量表达式字符串
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* formatPathToVariable(["user", "name"]) // "{{ ctx.user.name }}"
|
|
28
|
+
* formatPathToVariable([]) // "{{ ctx }}"
|
|
29
|
+
*/
|
|
30
|
+
export declare function formatPathToVariable(path: string[]): string;
|
|
31
|
+
/**
|
|
32
|
+
* 检查值是否为变量表达式
|
|
33
|
+
* @param value 待检查的值
|
|
34
|
+
* @returns 是否为变量表达式
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* isVariableExpression("{{ ctx.user.name }}") // true
|
|
38
|
+
* isVariableExpression("static value") // false
|
|
39
|
+
*/
|
|
40
|
+
export declare function isVariableExpression(value: any): boolean;
|