@nocobase/flow-engine 2.0.0-alpha.9 → 2.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/BlockScopedFlowEngine.d.ts +23 -0
- package/lib/BlockScopedFlowEngine.js +92 -0
- package/lib/FlowDefinition.d.ts +6 -4
- package/lib/JSRunner.js +3 -0
- package/lib/ViewScopedFlowEngine.js +15 -1
- package/lib/acl/Acl.d.ts +12 -12
- package/lib/acl/Acl.js +78 -30
- package/lib/components/DynamicFlowsEditor.js +2 -4
- package/lib/components/FieldModelRenderer.js +10 -8
- package/lib/components/FieldSkeleton.d.ts +10 -0
- package/lib/components/FieldSkeleton.js +64 -0
- package/lib/components/FlowContextSelector.js +19 -3
- package/lib/components/FlowModelRenderer.d.ts +2 -1
- package/lib/components/FlowModelRenderer.js +34 -12
- package/lib/components/FormItem.js +5 -1
- package/lib/components/MobilePopup.d.ts +20 -0
- package/lib/components/MobilePopup.js +102 -0
- package/lib/components/MobilePopup.style.d.ts +17 -0
- package/lib/components/MobilePopup.style.js +186 -0
- package/lib/components/common/withFlowDesignMode.d.ts +1 -1
- package/lib/components/common/withFlowDesignMode.js +5 -5
- package/lib/components/index.d.ts +1 -0
- package/lib/components/index.js +3 -1
- package/lib/components/settings/independents/dropdown/FlowsDropdownButton.js +71 -53
- package/lib/components/settings/wrappers/component/SelectWithTitle.d.ts +19 -0
- package/lib/components/settings/wrappers/component/SelectWithTitle.js +136 -0
- package/lib/components/settings/wrappers/component/SwitchWithTitle.d.ts +10 -0
- package/lib/components/settings/wrappers/component/SwitchWithTitle.js +110 -0
- package/lib/components/settings/wrappers/contextual/DefaultSettingsIcon.js +221 -93
- package/lib/components/settings/wrappers/contextual/FlowsContextMenu.js +71 -54
- package/lib/components/settings/wrappers/contextual/FlowsFloatContextMenu.d.ts +2 -2
- package/lib/components/settings/wrappers/contextual/FlowsFloatContextMenu.js +63 -23
- package/lib/components/settings/wrappers/contextual/StepSettingsDialog.js +11 -6
- package/lib/components/settings/wrappers/embedded/FlowSettings.js +42 -28
- package/lib/components/settings/wrappers/embedded/FlowsSettings.js +3 -3
- package/lib/components/settings/wrappers/embedded/FlowsSettingsContent.js +52 -32
- package/lib/components/subModel/AddSubModelButton.d.ts +7 -0
- package/lib/components/subModel/AddSubModelButton.js +78 -8
- package/lib/components/subModel/LazyDropdown.js +14 -15
- package/lib/components/subModel/utils.d.ts +1 -1
- package/lib/components/subModel/utils.js +21 -11
- package/lib/components/variables/VariableInput.js +5 -3
- package/lib/components/variables/types.d.ts +2 -0
- package/lib/components/variables/utils.js +4 -2
- package/lib/data-source/index.d.ts +43 -4
- package/lib/data-source/index.js +104 -11
- package/lib/data-source/jioToJoiSchema.js +1 -0
- package/lib/emitter.d.ts +6 -0
- package/lib/emitter.js +12 -0
- package/lib/executor/FlowExecutor.js +48 -7
- package/lib/flow-registry/GlobalFlowRegistry.d.ts +1 -0
- package/lib/flow-registry/GlobalFlowRegistry.js +3 -0
- package/lib/flow-registry/InstanceFlowRegistry.d.ts +1 -0
- package/lib/flow-registry/InstanceFlowRegistry.js +3 -0
- package/lib/flowContext.d.ts +6 -0
- package/lib/flowContext.js +111 -30
- package/lib/flowEngine.d.ts +49 -0
- package/lib/flowEngine.js +265 -10
- package/lib/flowSettings.d.ts +4 -3
- package/lib/flowSettings.js +33 -11
- package/lib/hooks/useApplyAutoFlows.d.ts +1 -0
- package/lib/hooks/useApplyAutoFlows.js +2 -2
- package/lib/index.d.ts +4 -2
- package/lib/index.js +11 -5
- package/lib/locale/de-DE.json +62 -0
- package/lib/locale/en-US.json +57 -45
- package/lib/locale/es-ES.json +62 -0
- package/lib/locale/fr-FR.json +62 -0
- package/lib/locale/hu-HU.json +62 -0
- package/lib/locale/id-ID.json +62 -0
- package/lib/locale/index.d.ts +114 -90
- package/lib/locale/it-IT.json +62 -0
- package/lib/locale/ja-JP.json +62 -0
- package/lib/locale/ko-KR.json +62 -0
- package/lib/locale/nl-NL.json +62 -0
- package/lib/locale/pt-BR.json +62 -0
- package/lib/locale/ru-RU.json +62 -0
- package/lib/locale/tr-TR.json +62 -0
- package/lib/locale/uk-UA.json +62 -0
- package/lib/locale/vi-VN.json +62 -0
- package/lib/locale/zh-CN.json +58 -46
- package/lib/locale/zh-TW.json +62 -0
- package/lib/models/CollectionFieldModel.d.ts +6 -2
- package/lib/models/CollectionFieldModel.js +60 -14
- package/lib/models/flowModel.d.ts +43 -4
- package/lib/models/flowModel.js +128 -26
- package/lib/models/forkFlowModel.d.ts +6 -2
- package/lib/models/forkFlowModel.js +9 -2
- package/lib/provider.d.ts +3 -1
- package/lib/provider.js +4 -3
- package/lib/reactive/index.d.ts +10 -0
- package/lib/reactive/index.js +41 -0
- package/lib/reactive/observer.d.ts +19 -0
- package/lib/reactive/observer.js +109 -0
- package/lib/resources/baseRecordResource.d.ts +1 -0
- package/lib/resources/baseRecordResource.js +14 -3
- package/lib/resources/multiRecordResource.d.ts +4 -2
- package/lib/resources/multiRecordResource.js +15 -6
- package/lib/resources/singleRecordResource.js +6 -3
- package/lib/resources/sqlResource.d.ts +1 -0
- package/lib/resources/sqlResource.js +22 -25
- package/lib/runjs-context/contexts/base.js +42 -6
- package/lib/runjs-context/snippets/global/clipboard-copy-text.snippet.d.ts +11 -0
- package/lib/runjs-context/snippets/global/clipboard-copy-text.snippet.js +61 -0
- package/lib/runjs-context/snippets/index.js +3 -0
- package/lib/runjs-context/snippets/scene/block/render-antd-icons.snippet.d.ts +11 -0
- package/lib/runjs-context/snippets/scene/block/render-antd-icons.snippet.js +65 -0
- package/lib/runjs-context/snippets/scene/block/render-button-handler.snippet.js +6 -4
- package/lib/runjs-context/snippets/scene/block/render-info-card.snippet.js +15 -16
- package/lib/runjs-context/snippets/scene/block/render-react-jsx.snippet.d.ts +11 -0
- package/lib/runjs-context/snippets/scene/block/render-react-jsx.snippet.js +58 -0
- package/lib/runjs-context/snippets/scene/block/render-react.snippet.js +7 -7
- package/lib/runjs-context/snippets/scene/block/render-statistics.snippet.js +24 -29
- package/lib/runjs-context/snippets/scene/block/render-timeline.snippet.js +20 -21
- package/lib/scheduler/ModelOperationScheduler.d.ts +51 -0
- package/lib/scheduler/ModelOperationScheduler.js +262 -0
- package/lib/types.d.ts +42 -7
- package/lib/types.js +4 -3
- package/lib/utils/associationObjectVariable.d.ts +32 -0
- package/lib/utils/associationObjectVariable.js +157 -0
- package/lib/utils/createCollectionContextMeta.d.ts +1 -1
- package/lib/utils/createCollectionContextMeta.js +8 -4
- package/lib/utils/createEphemeralContext.d.ts +13 -0
- package/lib/utils/createEphemeralContext.js +140 -0
- package/lib/utils/flows.d.ts +10 -0
- package/lib/utils/flows.js +48 -0
- package/lib/utils/index.d.ts +7 -3
- package/lib/utils/index.js +20 -0
- package/lib/utils/jsxTransform.d.ts +15 -0
- package/lib/utils/jsxTransform.js +68 -0
- package/lib/utils/params-resolvers.js +3 -3
- package/lib/utils/parsePathnameToViewParams.d.ts +1 -1
- package/lib/utils/parsePathnameToViewParams.js +41 -5
- package/lib/utils/pruneFilter.d.ts +21 -0
- package/lib/utils/pruneFilter.js +52 -0
- package/lib/utils/safeGlobals.d.ts +5 -3
- package/lib/utils/safeGlobals.js +42 -1
- package/lib/utils/schema-utils.d.ts +6 -0
- package/lib/utils/schema-utils.js +71 -6
- package/lib/utils/serverContextParams.d.ts +3 -0
- package/lib/utils/serverContextParams.js +2 -0
- package/lib/utils/translation.d.ts +4 -1
- package/lib/utils/translation.js +6 -2
- package/lib/utils/variablesParams.d.ts +21 -5
- package/lib/utils/variablesParams.js +103 -34
- package/lib/views/DialogComponent.js +1 -5
- package/lib/views/DrawerComponent.js +18 -9
- package/lib/views/PageComponent.js +3 -4
- package/lib/views/ViewNavigation.d.ts +11 -15
- package/lib/views/ViewNavigation.js +37 -19
- package/lib/views/createViewMeta.d.ts +3 -2
- package/lib/views/createViewMeta.js +164 -53
- package/lib/views/useDialog.d.ts +2 -1
- package/lib/views/useDialog.js +36 -30
- package/lib/views/useDrawer.d.ts +2 -1
- package/lib/views/useDrawer.js +33 -26
- package/lib/views/usePage.d.ts +2 -1
- package/lib/views/usePage.js +40 -29
- package/package.json +6 -3
- package/src/BlockScopedFlowEngine.ts +88 -0
- package/src/JSRunner.ts +3 -0
- package/src/ViewScopedFlowEngine.ts +16 -0
- package/src/__tests__/JSRunner.test.ts +62 -53
- package/src/__tests__/blockScopedFlowEngine.test.ts +154 -0
- package/src/__tests__/createViewMeta.popup.test.ts +142 -0
- package/src/__tests__/flow-engine.test.ts +3 -0
- package/src/__tests__/flowContext.test.ts +70 -0
- package/src/__tests__/flowEngine.destroyModel.test.ts +74 -0
- package/src/__tests__/flowEngine.moveModel.test.ts +43 -0
- package/src/__tests__/flowEngine.removeModel.test.ts +72 -0
- package/src/__tests__/flowEngine.saveModel.test.ts +4 -0
- package/src/__tests__/flowModel.openView.navigation.test.ts +3 -2
- package/src/__tests__/flowSettings.open.test.tsx +2 -0
- package/src/__tests__/flowSettings.test.ts +2 -0
- package/src/__tests__/globalFlowRegistry.test.ts +1 -1
- package/src/__tests__/modelOperationScheduler.test.ts +346 -0
- package/src/__tests__/objectVariable.test.ts +464 -0
- package/src/__tests__/runjsRuntimeFeatures.test.ts +12 -0
- package/src/__tests__/viewScopedFlowEngine.test.ts +98 -0
- package/src/acl/Acl.tsx +85 -31
- package/src/acl/__tests__/Acl.test.tsx +43 -1
- package/src/components/DynamicFlowsEditor.tsx +0 -10
- package/src/components/FieldModelRenderer.tsx +15 -8
- package/src/components/FieldSkeleton.tsx +27 -0
- package/src/components/FlowContextSelector.tsx +20 -2
- package/src/components/FlowModelRenderer.tsx +46 -12
- package/src/components/FormItem.tsx +8 -1
- package/src/components/MobilePopup.style.ts +220 -0
- package/src/components/MobilePopup.tsx +86 -0
- package/src/components/__tests__/FlowModelRenderer.test.tsx +89 -0
- package/src/components/__tests__/flow-model-render-error-fallback.test.tsx +1 -1
- package/src/components/common/withFlowDesignMode.tsx +5 -5
- package/src/components/index.ts +1 -0
- package/src/components/settings/independents/dropdown/FlowsDropdownButton.tsx +34 -17
- package/src/components/settings/wrappers/component/SelectWithTitle.tsx +110 -0
- package/src/components/settings/wrappers/component/SwitchWithTitle.tsx +82 -0
- package/src/components/settings/wrappers/contextual/DefaultSettingsIcon.tsx +260 -121
- package/src/components/settings/wrappers/contextual/FlowsContextMenu.tsx +34 -18
- package/src/components/settings/wrappers/contextual/FlowsFloatContextMenu.tsx +56 -18
- package/src/components/settings/wrappers/contextual/StepSettings.tsx +1 -2
- package/src/components/settings/wrappers/contextual/StepSettingsDialog.tsx +12 -6
- package/src/components/settings/wrappers/contextual/__tests__/DefaultSettingsIcon.test.tsx +565 -0
- package/src/components/settings/wrappers/embedded/FlowSettings.tsx +47 -35
- package/src/components/settings/wrappers/embedded/FlowsSettings.tsx +1 -1
- package/src/components/settings/wrappers/embedded/FlowsSettingsContent.tsx +64 -42
- package/src/components/subModel/AddSubModelButton.tsx +104 -9
- package/src/components/subModel/LazyDropdown.tsx +14 -14
- package/src/components/subModel/__tests__/AddSubModelButton.test.tsx +168 -7
- package/src/components/subModel/__tests__/utils.test.ts +12 -12
- package/src/components/subModel/utils.ts +25 -6
- package/src/components/variables/VariableInput.tsx +5 -3
- package/src/components/variables/types.ts +2 -0
- package/src/components/variables/utils.ts +7 -3
- package/src/data-source/index.ts +169 -11
- package/src/data-source/jioToJoiSchema.ts +1 -0
- package/src/emitter.ts +14 -0
- package/src/executor/FlowExecutor.ts +56 -8
- package/src/executor/__tests__/ctx-defs-injection.test.ts +197 -0
- package/src/flow-registry/GlobalFlowRegistry.ts +1 -0
- package/src/flow-registry/InstanceFlowRegistry.ts +1 -0
- package/src/flow-registry/__tests__/globalFlowRegistry.test.ts +54 -0
- package/src/flowContext.ts +144 -29
- package/src/flowEngine.ts +328 -8
- package/src/flowSettings.ts +47 -19
- package/src/hooks/useApplyAutoFlows.ts +3 -3
- package/src/index.ts +4 -2
- package/src/locale/de-DE.json +62 -0
- package/src/locale/en-US.json +57 -45
- package/src/locale/es-ES.json +62 -0
- package/src/locale/fr-FR.json +62 -0
- package/src/locale/hu-HU.json +62 -0
- package/src/locale/id-ID.json +62 -0
- package/src/locale/it-IT.json +62 -0
- package/src/locale/ja-JP.json +62 -0
- package/src/locale/ko-KR.json +62 -0
- package/src/locale/nl-NL.json +62 -0
- package/src/locale/pt-BR.json +62 -0
- package/src/locale/ru-RU.json +62 -0
- package/src/locale/tr-TR.json +62 -0
- package/src/locale/uk-UA.json +62 -0
- package/src/locale/vi-VN.json +62 -0
- package/src/locale/zh-CN.json +58 -46
- package/src/locale/zh-TW.json +62 -0
- package/src/models/CollectionFieldModel.tsx +79 -17
- package/src/models/__tests__/dispatchEvent.behavior.test.ts +169 -0
- package/src/models/__tests__/flowEngine.resolveUse.test.ts +170 -0
- package/src/models/__tests__/flowModel.getFlows.sort.test.ts +29 -5
- package/src/models/__tests__/flowModel.scheduleModelOperation.test.tsx +129 -0
- package/src/models/__tests__/flowModel.test.ts +65 -27
- package/src/models/__tests__/forkFlowModel.test.ts +40 -7
- package/src/models/flowModel.tsx +192 -30
- package/src/models/forkFlowModel.ts +11 -3
- package/src/provider.tsx +5 -5
- package/src/reactive/__tests__/observer.test.tsx +211 -0
- package/src/reactive/index.ts +11 -0
- package/src/reactive/observer.tsx +101 -0
- package/src/resources/baseRecordResource.ts +15 -3
- package/src/resources/multiRecordResource.ts +17 -8
- package/src/resources/singleRecordResource.ts +6 -3
- package/src/resources/sqlResource.ts +22 -26
- package/src/runjs-context/contexts/base.ts +47 -6
- package/src/runjs-context/snippets/global/clipboard-copy-text.snippet.ts +42 -0
- package/src/runjs-context/snippets/index.ts +3 -0
- package/src/runjs-context/snippets/scene/block/render-antd-icons.snippet.ts +46 -0
- package/src/runjs-context/snippets/scene/block/render-button-handler.snippet.ts +6 -4
- package/src/runjs-context/snippets/scene/block/render-info-card.snippet.ts +15 -16
- package/src/runjs-context/snippets/scene/block/render-react-jsx.snippet.ts +39 -0
- package/src/runjs-context/snippets/scene/block/render-react.snippet.ts +7 -7
- package/src/runjs-context/snippets/scene/block/render-statistics.snippet.ts +24 -29
- package/src/runjs-context/snippets/scene/block/render-timeline.snippet.ts +20 -21
- package/src/scheduler/ModelOperationScheduler.ts +304 -0
- package/src/types.ts +50 -4
- package/src/utils/__tests__/createCollectionContextMeta.test.ts +51 -0
- package/src/utils/__tests__/flows.test.ts +65 -0
- package/src/utils/__tests__/jsxTransform.test.ts +38 -0
- package/src/utils/__tests__/parsePathnameToViewParams.test.ts +25 -0
- package/src/utils/__tests__/pruneFilter.test.ts +38 -0
- package/src/utils/__tests__/safeGlobals.test.ts +23 -1
- package/src/utils/__tests__/utils.test.ts +114 -15
- package/src/utils/__tests__/variablesParams.test.ts +120 -0
- package/src/utils/associationObjectVariable.ts +180 -0
- package/src/utils/createCollectionContextMeta.ts +8 -3
- package/src/utils/createEphemeralContext.ts +142 -0
- package/src/utils/flows.ts +23 -0
- package/src/utils/index.ts +11 -2
- package/src/utils/jsxTransform.ts +39 -0
- package/src/utils/params-resolvers.ts +2 -2
- package/src/utils/parsePathnameToViewParams.ts +50 -6
- package/src/utils/pruneFilter.ts +41 -0
- package/src/utils/safeGlobals.ts +51 -4
- package/src/utils/schema-utils.ts +81 -3
- package/src/utils/serverContextParams.ts +5 -0
- package/src/utils/translation.ts +7 -2
- package/src/utils/variablesParams.ts +125 -42
- package/src/views/DialogComponent.tsx +1 -4
- package/src/views/DrawerComponent.tsx +19 -7
- package/src/views/PageComponent.tsx +2 -4
- package/src/views/ViewNavigation.ts +49 -43
- package/src/views/__tests__/FlowView.usePage.test.tsx +133 -0
- package/src/views/__tests__/ViewNavigation.test.ts +54 -34
- package/src/views/__tests__/useDialog.closeDestroy.test.tsx +132 -0
- package/src/views/createViewMeta.ts +179 -42
- package/src/views/useDialog.tsx +36 -24
- package/src/views/useDrawer.tsx +37 -24
- package/src/views/usePage.tsx +46 -27
package/lib/utils/index.js
CHANGED
|
@@ -35,10 +35,15 @@ __export(utils_exports, {
|
|
|
35
35
|
clearAutoFlowError: () => import_autoFlowError.clearAutoFlowError,
|
|
36
36
|
collectContextParamsForTemplate: () => import_variablesParams.collectContextParamsForTemplate,
|
|
37
37
|
compileUiSchema: () => import_schema_utils.compileUiSchema,
|
|
38
|
+
createAssociationAwareObjectMetaFactory: () => import_associationObjectVariable.createAssociationAwareObjectMetaFactory,
|
|
39
|
+
createAssociationSubpathResolver: () => import_associationObjectVariable.createAssociationSubpathResolver,
|
|
38
40
|
createCollectionContextMeta: () => import_createCollectionContextMeta.createCollectionContextMeta,
|
|
39
41
|
createCurrentRecordMetaFactory: () => import_variablesParams.createCurrentRecordMetaFactory,
|
|
42
|
+
createEphemeralContext: () => import_createEphemeralContext.createEphemeralContext,
|
|
40
43
|
createRecordMetaFactory: () => import_variablesParams.createRecordMetaFactory,
|
|
44
|
+
createRecordResolveOnServerWithLocal: () => import_variablesParams.createRecordResolveOnServerWithLocal,
|
|
41
45
|
createSafeDocument: () => import_safeGlobals.createSafeDocument,
|
|
46
|
+
createSafeNavigator: () => import_safeGlobals.createSafeNavigator,
|
|
42
47
|
createSafeWindow: () => import_safeGlobals.createSafeWindow,
|
|
43
48
|
defineAction: () => import_flow_definitions.defineAction,
|
|
44
49
|
escapeT: () => import_translation.escapeT,
|
|
@@ -49,9 +54,11 @@ __export(utils_exports, {
|
|
|
49
54
|
getAutoFlowError: () => import_autoFlowError.getAutoFlowError,
|
|
50
55
|
getT: () => import_translation.getT,
|
|
51
56
|
inferRecordRef: () => import_variablesParams.inferRecordRef,
|
|
57
|
+
isBeforeRenderFlow: () => import_flows.isBeforeRenderFlow,
|
|
52
58
|
isInheritedFrom: () => import_inheritance.isInheritedFrom,
|
|
53
59
|
isVariableExpression: () => import_context.isVariableExpression,
|
|
54
60
|
parsePathnameToViewParams: () => import_parsePathnameToViewParams.parsePathnameToViewParams,
|
|
61
|
+
pruneFilter: () => import_pruneFilter.pruneFilter,
|
|
55
62
|
resolveCreateModelOptions: () => import_params_resolvers.resolveCreateModelOptions,
|
|
56
63
|
resolveDefaultParams: () => import_params_resolvers.resolveDefaultParams,
|
|
57
64
|
resolveExpressions: () => import_params_resolvers.resolveExpressions,
|
|
@@ -59,6 +66,7 @@ __export(utils_exports, {
|
|
|
59
66
|
resolveUiMode: () => import_schema_utils.resolveUiMode,
|
|
60
67
|
setAutoFlowError: () => import_autoFlowError.setAutoFlowError,
|
|
61
68
|
setupRuntimeContextSteps: () => import_setupRuntimeContextSteps.setupRuntimeContextSteps,
|
|
69
|
+
shouldHideStepInSettings: () => import_schema_utils.shouldHideStepInSettings,
|
|
62
70
|
tExpr: () => import_translation.tExpr
|
|
63
71
|
});
|
|
64
72
|
module.exports = __toCommonJS(utils_exports);
|
|
@@ -71,11 +79,15 @@ var import_params_resolvers = require("./params-resolvers");
|
|
|
71
79
|
var import_schema_utils = require("./schema-utils");
|
|
72
80
|
var import_setupRuntimeContextSteps = require("./setupRuntimeContextSteps");
|
|
73
81
|
var import_createCollectionContextMeta = require("./createCollectionContextMeta");
|
|
82
|
+
var import_associationObjectVariable = require("./associationObjectVariable");
|
|
74
83
|
var import_variablesParams = require("./variablesParams");
|
|
75
84
|
var import_context = require("./context");
|
|
76
85
|
var import_autoFlowError = require("./autoFlowError");
|
|
77
86
|
var import_parsePathnameToViewParams = require("./parsePathnameToViewParams");
|
|
78
87
|
var import_safeGlobals = require("./safeGlobals");
|
|
88
|
+
var import_createEphemeralContext = require("./createEphemeralContext");
|
|
89
|
+
var import_pruneFilter = require("./pruneFilter");
|
|
90
|
+
var import_flows = require("./flows");
|
|
79
91
|
// Annotate the CommonJS export names for ESM import in node:
|
|
80
92
|
0 && (module.exports = {
|
|
81
93
|
BLOCK_GROUP_CONFIGS,
|
|
@@ -87,10 +99,15 @@ var import_safeGlobals = require("./safeGlobals");
|
|
|
87
99
|
clearAutoFlowError,
|
|
88
100
|
collectContextParamsForTemplate,
|
|
89
101
|
compileUiSchema,
|
|
102
|
+
createAssociationAwareObjectMetaFactory,
|
|
103
|
+
createAssociationSubpathResolver,
|
|
90
104
|
createCollectionContextMeta,
|
|
91
105
|
createCurrentRecordMetaFactory,
|
|
106
|
+
createEphemeralContext,
|
|
92
107
|
createRecordMetaFactory,
|
|
108
|
+
createRecordResolveOnServerWithLocal,
|
|
93
109
|
createSafeDocument,
|
|
110
|
+
createSafeNavigator,
|
|
94
111
|
createSafeWindow,
|
|
95
112
|
defineAction,
|
|
96
113
|
escapeT,
|
|
@@ -101,9 +118,11 @@ var import_safeGlobals = require("./safeGlobals");
|
|
|
101
118
|
getAutoFlowError,
|
|
102
119
|
getT,
|
|
103
120
|
inferRecordRef,
|
|
121
|
+
isBeforeRenderFlow,
|
|
104
122
|
isInheritedFrom,
|
|
105
123
|
isVariableExpression,
|
|
106
124
|
parsePathnameToViewParams,
|
|
125
|
+
pruneFilter,
|
|
107
126
|
resolveCreateModelOptions,
|
|
108
127
|
resolveDefaultParams,
|
|
109
128
|
resolveExpressions,
|
|
@@ -111,5 +130,6 @@ var import_safeGlobals = require("./safeGlobals");
|
|
|
111
130
|
resolveUiMode,
|
|
112
131
|
setAutoFlowError,
|
|
113
132
|
setupRuntimeContextSteps,
|
|
133
|
+
shouldHideStepInSettings,
|
|
114
134
|
tExpr
|
|
115
135
|
});
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
* Lightweight JSX -> JS compiler for RunJS user code.
|
|
11
|
+
* - Uses sucrase via dynamic import (lazy; avoids static cycles and cost when not needed)
|
|
12
|
+
* - Maps JSX to ctx.React.createElement / ctx.React.Fragment so no global React is required
|
|
13
|
+
* - If sucrase is unavailable or transform throws, returns original code as graceful fallback
|
|
14
|
+
*/
|
|
15
|
+
export declare function compileRunJs(code: string): Promise<string>;
|
|
@@ -0,0 +1,68 @@
|
|
|
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 jsxTransform_exports = {};
|
|
39
|
+
__export(jsxTransform_exports, {
|
|
40
|
+
compileRunJs: () => compileRunJs
|
|
41
|
+
});
|
|
42
|
+
module.exports = __toCommonJS(jsxTransform_exports);
|
|
43
|
+
async function compileRunJs(code) {
|
|
44
|
+
var _a;
|
|
45
|
+
const maybeJSX = /<[A-Za-z]|<\//.test(code);
|
|
46
|
+
if (!maybeJSX) return code;
|
|
47
|
+
try {
|
|
48
|
+
const mod = await import("sucrase");
|
|
49
|
+
const transform = (mod == null ? void 0 : mod.transform) || ((_a = mod == null ? void 0 : mod.default) == null ? void 0 : _a.transform);
|
|
50
|
+
if (typeof transform !== "function") return code;
|
|
51
|
+
const res = transform(code, {
|
|
52
|
+
transforms: ["jsx"],
|
|
53
|
+
jsxPragma: "ctx.React.createElement",
|
|
54
|
+
jsxFragmentPragma: "ctx.React.Fragment",
|
|
55
|
+
// Keep ES syntax as-is; JSRunner runs in modern engines
|
|
56
|
+
disableESTransforms: true,
|
|
57
|
+
production: true
|
|
58
|
+
});
|
|
59
|
+
return (res && (res.code || (res == null ? void 0 : res.output))) ?? code;
|
|
60
|
+
} catch (_e) {
|
|
61
|
+
return code;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
__name(compileRunJs, "compileRunJs");
|
|
65
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
66
|
+
0 && (module.exports = {
|
|
67
|
+
compileRunJs
|
|
68
|
+
});
|
|
@@ -44,8 +44,8 @@ __export(params_resolvers_exports, {
|
|
|
44
44
|
resolveExpressions: () => resolveExpressions
|
|
45
45
|
});
|
|
46
46
|
module.exports = __toCommonJS(params_resolvers_exports);
|
|
47
|
+
var import_shared = require("@nocobase/shared");
|
|
47
48
|
var import_lodash = __toESM(require("lodash"));
|
|
48
|
-
var import_client = require("@nocobase/utils/client");
|
|
49
49
|
async function resolveDefaultParams(defaultParams, ctx) {
|
|
50
50
|
if (!defaultParams) {
|
|
51
51
|
return {};
|
|
@@ -275,9 +275,9 @@ async function compileExpression(expression, ctx) {
|
|
|
275
275
|
if (!first) return void 0;
|
|
276
276
|
const base = await ctx[first];
|
|
277
277
|
if (segs.length === 0) return base;
|
|
278
|
-
return (0,
|
|
278
|
+
return (0, import_shared.getValuesByPath)(base, segs.join("."));
|
|
279
279
|
}, "resolveDotOnlyPath");
|
|
280
|
-
const singleMatch = expression.match(/^\{\{\s*(
|
|
280
|
+
const singleMatch = expression.match(/^\s*\{\{\s*([^{}]+?)\s*\}\}\s*$/);
|
|
281
281
|
if (singleMatch) {
|
|
282
282
|
const inner = singleMatch[1];
|
|
283
283
|
const dotPath = matchDotOnly(inner);
|
|
@@ -54,16 +54,52 @@ const parsePathnameToViewParams = /* @__PURE__ */ __name((pathname) => {
|
|
|
54
54
|
break;
|
|
55
55
|
}
|
|
56
56
|
} else if (currentView && i + 1 < segments.length) {
|
|
57
|
-
const
|
|
57
|
+
const rawValue = segments[i + 1];
|
|
58
|
+
let decoded = rawValue;
|
|
59
|
+
try {
|
|
60
|
+
decoded = decodeURIComponent(rawValue);
|
|
61
|
+
} catch (_) {
|
|
62
|
+
}
|
|
58
63
|
switch (segment) {
|
|
59
64
|
case "tab":
|
|
60
|
-
currentView.tabUid =
|
|
65
|
+
currentView.tabUid = decoded;
|
|
61
66
|
break;
|
|
62
|
-
case "filterbytk":
|
|
63
|
-
|
|
67
|
+
case "filterbytk": {
|
|
68
|
+
const parseKeyValuePairs = /* @__PURE__ */ __name((s) => {
|
|
69
|
+
const obj = {};
|
|
70
|
+
s.split("&").forEach((pair) => {
|
|
71
|
+
const [k, v = ""] = pair.split("=");
|
|
72
|
+
if (!k) return;
|
|
73
|
+
try {
|
|
74
|
+
const key = decodeURIComponent(k);
|
|
75
|
+
const val = decodeURIComponent(v);
|
|
76
|
+
obj[key] = val;
|
|
77
|
+
} catch (_) {
|
|
78
|
+
obj[k] = v;
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
return obj;
|
|
82
|
+
}, "parseKeyValuePairs");
|
|
83
|
+
let parsed = decoded;
|
|
84
|
+
if (decoded && (decoded.startsWith("{") || decoded.startsWith("["))) {
|
|
85
|
+
try {
|
|
86
|
+
const maybe = JSON.parse(decoded);
|
|
87
|
+
if (maybe && typeof maybe === "object" && !Array.isArray(maybe)) {
|
|
88
|
+
parsed = maybe;
|
|
89
|
+
} else {
|
|
90
|
+
parsed = decoded;
|
|
91
|
+
}
|
|
92
|
+
} catch (_) {
|
|
93
|
+
parsed = decoded;
|
|
94
|
+
}
|
|
95
|
+
} else if (decoded && decoded.includes("=") && decoded.includes("&")) {
|
|
96
|
+
parsed = parseKeyValuePairs(decoded);
|
|
97
|
+
}
|
|
98
|
+
currentView.filterByTk = parsed;
|
|
64
99
|
break;
|
|
100
|
+
}
|
|
65
101
|
case "sourceid":
|
|
66
|
-
currentView.sourceId =
|
|
102
|
+
currentView.sourceId = decoded;
|
|
67
103
|
break;
|
|
68
104
|
default:
|
|
69
105
|
break;
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
*
|
|
12
|
+
* 规则:
|
|
13
|
+
* - 移除:`null`、`undefined`、空字符串 `''`、空数组 `[]`、空对象 `{}`;
|
|
14
|
+
* - 保留:`false`、`0` 等有意义的“假值”。
|
|
15
|
+
*
|
|
16
|
+
* 注意:当清理后整体变为空结构时,返回 `undefined`,用于表示无需下发该条件。
|
|
17
|
+
*
|
|
18
|
+
* @param input 任意筛选对象/数组/原始值
|
|
19
|
+
* @returns 清理后的对象;若为空则返回 `undefined`
|
|
20
|
+
*/
|
|
21
|
+
export declare function pruneFilter<T = any>(input: T): T | undefined;
|
|
@@ -0,0 +1,52 @@
|
|
|
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 pruneFilter_exports = {};
|
|
29
|
+
__export(pruneFilter_exports, {
|
|
30
|
+
pruneFilter: () => pruneFilter
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(pruneFilter_exports);
|
|
33
|
+
function pruneFilter(input) {
|
|
34
|
+
if (Array.isArray(input)) {
|
|
35
|
+
const arr = input.map((v) => pruneFilter(v)).filter((v) => v !== void 0);
|
|
36
|
+
return arr.length ? arr : void 0;
|
|
37
|
+
}
|
|
38
|
+
if (input && typeof input === "object") {
|
|
39
|
+
const out = {};
|
|
40
|
+
Object.keys(input).forEach((k) => {
|
|
41
|
+
const v = pruneFilter(input[k]);
|
|
42
|
+
if (v !== void 0) out[k] = v;
|
|
43
|
+
});
|
|
44
|
+
return Object.keys(out).length ? out : void 0;
|
|
45
|
+
}
|
|
46
|
+
return input === null || input === void 0 || typeof input === "string" && input === "" ? void 0 : input;
|
|
47
|
+
}
|
|
48
|
+
__name(pruneFilter, "pruneFilter");
|
|
49
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
50
|
+
0 && (module.exports = {
|
|
51
|
+
pruneFilter
|
|
52
|
+
});
|
|
@@ -7,10 +7,12 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
/**
|
|
10
|
-
* 统一的安全全局对象代理:window/document
|
|
11
|
-
* -
|
|
12
|
-
* - document
|
|
10
|
+
* 统一的安全全局对象代理:window/document/navigator
|
|
11
|
+
* - window:仅允许常用的定时器、console、Math、Date、FormData、addEventListener、open(安全包装)、location(安全代理)
|
|
12
|
+
* - document:仅允许 createElement/querySelector/querySelectorAll
|
|
13
|
+
* - navigator:仅提供极少量低风险能力(clipboard.writeText、onLine、language、languages)
|
|
13
14
|
* - 不允许随意访问未声明的属性,最小权限原则
|
|
14
15
|
*/
|
|
15
16
|
export declare function createSafeWindow(extra?: Record<string, any>): {};
|
|
16
17
|
export declare function createSafeDocument(extra?: Record<string, any>): {};
|
|
18
|
+
export declare function createSafeNavigator(extra?: Record<string, any>): {};
|
package/lib/utils/safeGlobals.js
CHANGED
|
@@ -28,6 +28,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
28
28
|
var safeGlobals_exports = {};
|
|
29
29
|
__export(safeGlobals_exports, {
|
|
30
30
|
createSafeDocument: () => createSafeDocument,
|
|
31
|
+
createSafeNavigator: () => createSafeNavigator,
|
|
31
32
|
createSafeWindow: () => createSafeWindow
|
|
32
33
|
});
|
|
33
34
|
module.exports = __toCommonJS(safeGlobals_exports);
|
|
@@ -110,7 +111,7 @@ function createSafeWindow(extra) {
|
|
|
110
111
|
case "replace":
|
|
111
112
|
return (u) => guardedNavigate(u, { replace: true });
|
|
112
113
|
case "reload":
|
|
113
|
-
|
|
114
|
+
return window.location.reload.bind(window.location);
|
|
114
115
|
case "href":
|
|
115
116
|
throw new Error("Reading location.href is not allowed.");
|
|
116
117
|
default:
|
|
@@ -135,6 +136,7 @@ function createSafeWindow(extra) {
|
|
|
135
136
|
console,
|
|
136
137
|
Math,
|
|
137
138
|
Date,
|
|
139
|
+
FormData,
|
|
138
140
|
// 事件侦听仅绑定到真实 window,便于少量需要的全局监听
|
|
139
141
|
addEventListener: addEventListener.bind(window),
|
|
140
142
|
// 安全的 window.open 代理
|
|
@@ -172,8 +174,47 @@ function createSafeDocument(extra) {
|
|
|
172
174
|
);
|
|
173
175
|
}
|
|
174
176
|
__name(createSafeDocument, "createSafeDocument");
|
|
177
|
+
function createSafeNavigator(extra) {
|
|
178
|
+
var _a;
|
|
179
|
+
const nav = typeof window !== "undefined" && window.navigator || void 0;
|
|
180
|
+
const clipboard = {};
|
|
181
|
+
const writeText = (_a = nav == null ? void 0 : nav.clipboard) == null ? void 0 : _a.writeText;
|
|
182
|
+
if (typeof writeText === "function") {
|
|
183
|
+
clipboard.writeText = writeText.bind(nav.clipboard);
|
|
184
|
+
}
|
|
185
|
+
const allowed = {
|
|
186
|
+
clipboard
|
|
187
|
+
};
|
|
188
|
+
Object.defineProperty(allowed, "onLine", {
|
|
189
|
+
get: /* @__PURE__ */ __name(() => !!(nav == null ? void 0 : nav.onLine), "get"),
|
|
190
|
+
enumerable: true,
|
|
191
|
+
configurable: false
|
|
192
|
+
});
|
|
193
|
+
Object.defineProperty(allowed, "language", {
|
|
194
|
+
get: /* @__PURE__ */ __name(() => nav == null ? void 0 : nav.language, "get"),
|
|
195
|
+
enumerable: true,
|
|
196
|
+
configurable: false
|
|
197
|
+
});
|
|
198
|
+
Object.defineProperty(allowed, "languages", {
|
|
199
|
+
get: /* @__PURE__ */ __name(() => (nav == null ? void 0 : nav.languages) ? [...nav.languages] : void 0, "get"),
|
|
200
|
+
enumerable: true,
|
|
201
|
+
configurable: false
|
|
202
|
+
});
|
|
203
|
+
Object.assign(allowed, extra || {});
|
|
204
|
+
return new Proxy(
|
|
205
|
+
{},
|
|
206
|
+
{
|
|
207
|
+
get(_t, prop) {
|
|
208
|
+
if (prop in allowed) return allowed[prop];
|
|
209
|
+
throw new Error(`Access to navigator property "${String(prop)}" is not allowed.`);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
__name(createSafeNavigator, "createSafeNavigator");
|
|
175
215
|
// Annotate the CommonJS export names for ESM import in node:
|
|
176
216
|
0 && (module.exports = {
|
|
177
217
|
createSafeDocument,
|
|
218
|
+
createSafeNavigator,
|
|
178
219
|
createSafeWindow
|
|
179
220
|
});
|
|
@@ -38,3 +38,9 @@ export declare function compileUiSchema(scope: Record<string, any>, uiSchema: an
|
|
|
38
38
|
* @returns 合并后的uiSchema对象,如果为空则返回null
|
|
39
39
|
*/
|
|
40
40
|
export declare function resolveStepUiSchema<TModel extends FlowModel = FlowModel>(model: TModel, flow: any, step: StepDefinition): Promise<Record<string, ISchema> | null>;
|
|
41
|
+
/**
|
|
42
|
+
* 判断步骤在设置菜单中是否应被隐藏。
|
|
43
|
+
* - 支持 StepDefinition.hideInSettings 与 ActionDefinition.hideInSettings(step 优先)。
|
|
44
|
+
* - hideInSettings 可为布尔值或函数(接收 FlowRuntimeContext)。
|
|
45
|
+
*/
|
|
46
|
+
export declare function shouldHideStepInSettings<TModel extends FlowModel = FlowModel>(model: TModel, flow: any, step: StepDefinition): Promise<boolean>;
|
|
@@ -29,7 +29,8 @@ var schema_utils_exports = {};
|
|
|
29
29
|
__export(schema_utils_exports, {
|
|
30
30
|
compileUiSchema: () => compileUiSchema,
|
|
31
31
|
resolveStepUiSchema: () => resolveStepUiSchema,
|
|
32
|
-
resolveUiMode: () => resolveUiMode
|
|
32
|
+
resolveUiMode: () => resolveUiMode,
|
|
33
|
+
shouldHideStepInSettings: () => shouldHideStepInSettings
|
|
33
34
|
});
|
|
34
35
|
module.exports = __toCommonJS(schema_utils_exports);
|
|
35
36
|
var import_json_schema = require("@formily/json-schema");
|
|
@@ -68,6 +69,28 @@ async function resolveUiMode(uiMode, ctx) {
|
|
|
68
69
|
}
|
|
69
70
|
__name(resolveUiMode, "resolveUiMode");
|
|
70
71
|
const compileCache = {};
|
|
72
|
+
const hasFunctionValue = /* @__PURE__ */ __name((source) => {
|
|
73
|
+
if (typeof source === "function") return true;
|
|
74
|
+
if (!source || typeof source !== "object") return false;
|
|
75
|
+
const seen = /* @__PURE__ */ new WeakSet();
|
|
76
|
+
const walk = /* @__PURE__ */ __name((val) => {
|
|
77
|
+
if (typeof val === "function") return true;
|
|
78
|
+
if (!val || typeof val !== "object") return false;
|
|
79
|
+
if (seen.has(val)) return false;
|
|
80
|
+
seen.add(val);
|
|
81
|
+
if (Array.isArray(val)) {
|
|
82
|
+
for (const it of val) {
|
|
83
|
+
if (walk(it)) return true;
|
|
84
|
+
}
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
for (const k of Object.keys(val)) {
|
|
88
|
+
if (walk(val[k])) return true;
|
|
89
|
+
}
|
|
90
|
+
return false;
|
|
91
|
+
}, "walk");
|
|
92
|
+
return walk(source);
|
|
93
|
+
}, "hasFunctionValue");
|
|
71
94
|
function compileUiSchema(scope, uiSchema, options = {}) {
|
|
72
95
|
const { noCache = false } = options;
|
|
73
96
|
const hasVariable = /* @__PURE__ */ __name((source) => {
|
|
@@ -88,8 +111,17 @@ function compileUiSchema(scope, uiSchema, options = {}) {
|
|
|
88
111
|
console.warn("Failed to stringify:", e);
|
|
89
112
|
return source;
|
|
90
113
|
}
|
|
91
|
-
if (compileCache[cacheKey]) return compileCache[cacheKey];
|
|
92
114
|
shouldCompile = hasVariable(cacheKey);
|
|
115
|
+
const hasFn = shouldCompile && !noCache ? hasFunctionValue(source) : false;
|
|
116
|
+
if (compileCache[cacheKey] && !noCache && !hasFn) return compileCache[cacheKey];
|
|
117
|
+
if (hasFn) {
|
|
118
|
+
try {
|
|
119
|
+
return import_json_schema.Schema.compile(source, scope);
|
|
120
|
+
} catch (error) {
|
|
121
|
+
console.warn("Failed to compile with Formily Schema.compile:", error);
|
|
122
|
+
return source;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
93
125
|
}
|
|
94
126
|
if (Array.isArray(source)) {
|
|
95
127
|
try {
|
|
@@ -98,8 +130,17 @@ function compileUiSchema(scope, uiSchema, options = {}) {
|
|
|
98
130
|
console.warn("Failed to stringify:", e);
|
|
99
131
|
return source;
|
|
100
132
|
}
|
|
101
|
-
if (compileCache[cacheKey]) return compileCache[cacheKey];
|
|
102
133
|
shouldCompile = hasVariable(cacheKey);
|
|
134
|
+
const hasFn = shouldCompile && !noCache ? hasFunctionValue(source) : false;
|
|
135
|
+
if (compileCache[cacheKey] && !noCache && !hasFn) return compileCache[cacheKey];
|
|
136
|
+
if (hasFn) {
|
|
137
|
+
try {
|
|
138
|
+
return import_json_schema.Schema.compile(source, scope);
|
|
139
|
+
} catch (error) {
|
|
140
|
+
console.warn("Failed to compile with Formily Schema.compile:", error);
|
|
141
|
+
return source;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
103
144
|
}
|
|
104
145
|
if (shouldCompile) {
|
|
105
146
|
if (!cacheKey) {
|
|
@@ -131,14 +172,14 @@ function compileUiSchema(scope, uiSchema, options = {}) {
|
|
|
131
172
|
}
|
|
132
173
|
__name(compileUiSchema, "compileUiSchema");
|
|
133
174
|
async function resolveStepUiSchema(model, flow, step) {
|
|
134
|
-
var _a
|
|
175
|
+
var _a;
|
|
135
176
|
const flowRuntimeContext = new import_flowContext.FlowRuntimeContext(model, flow.key, "settings");
|
|
136
177
|
(0, import_setupRuntimeContextSteps.setupRuntimeContextSteps)(flowRuntimeContext, flow.steps, model, flow.key);
|
|
137
178
|
flowRuntimeContext.defineProperty("currentStep", { value: step });
|
|
138
179
|
let stepUiSchema = step.uiSchema;
|
|
139
180
|
if (step.use) {
|
|
140
181
|
try {
|
|
141
|
-
const action = (
|
|
182
|
+
const action = (_a = model.getAction) == null ? void 0 : _a.call(model, step.use);
|
|
142
183
|
if (action && action.uiSchema) {
|
|
143
184
|
stepUiSchema = stepUiSchema || action.uiSchema;
|
|
144
185
|
}
|
|
@@ -153,9 +194,33 @@ async function resolveStepUiSchema(model, flow, step) {
|
|
|
153
194
|
return resolvedStepUiSchema;
|
|
154
195
|
}
|
|
155
196
|
__name(resolveStepUiSchema, "resolveStepUiSchema");
|
|
197
|
+
async function shouldHideStepInSettings(model, flow, step) {
|
|
198
|
+
var _a;
|
|
199
|
+
if (!step) return true;
|
|
200
|
+
let hideInSettings = step.hideInSettings;
|
|
201
|
+
if (typeof hideInSettings === "undefined" && step.use) {
|
|
202
|
+
const action = (_a = model.getAction) == null ? void 0 : _a.call(model, step.use);
|
|
203
|
+
hideInSettings = action == null ? void 0 : action.hideInSettings;
|
|
204
|
+
}
|
|
205
|
+
if (typeof hideInSettings === "function") {
|
|
206
|
+
try {
|
|
207
|
+
const ctx = new import_flowContext.FlowRuntimeContext(model, flow.key, "settings");
|
|
208
|
+
(0, import_setupRuntimeContextSteps.setupRuntimeContextSteps)(ctx, flow.steps, model, flow.key);
|
|
209
|
+
ctx.defineProperty("currentStep", { value: step });
|
|
210
|
+
const result = await hideInSettings(ctx);
|
|
211
|
+
return !!result;
|
|
212
|
+
} catch (error) {
|
|
213
|
+
console.warn(`Error evaluating hideInSettings for step '${step.key || ""}' in flow '${flow.key}':`, error);
|
|
214
|
+
return false;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return !!hideInSettings;
|
|
218
|
+
}
|
|
219
|
+
__name(shouldHideStepInSettings, "shouldHideStepInSettings");
|
|
156
220
|
// Annotate the CommonJS export names for ESM import in node:
|
|
157
221
|
0 && (module.exports = {
|
|
158
222
|
compileUiSchema,
|
|
159
223
|
resolveStepUiSchema,
|
|
160
|
-
resolveUiMode
|
|
224
|
+
resolveUiMode,
|
|
225
|
+
shouldHideStepInSettings
|
|
161
226
|
});
|
|
@@ -12,6 +12,7 @@ export type RecordRef = {
|
|
|
12
12
|
id?: any;
|
|
13
13
|
filterByTk?: any;
|
|
14
14
|
dataSourceKey?: string;
|
|
15
|
+
associationName?: string;
|
|
15
16
|
sourceId?: any;
|
|
16
17
|
fields?: string[];
|
|
17
18
|
appends?: string[];
|
|
@@ -23,6 +24,8 @@ export type NormalizedRecordParams = {
|
|
|
23
24
|
collection: string;
|
|
24
25
|
filterByTk: any;
|
|
25
26
|
dataSourceKey?: string;
|
|
27
|
+
associationName?: string;
|
|
28
|
+
sourceId?: any;
|
|
26
29
|
fields?: string[];
|
|
27
30
|
appends?: string[];
|
|
28
31
|
};
|
|
@@ -14,5 +14,8 @@ import type { FlowModel } from '../models';
|
|
|
14
14
|
* @returns 翻译函数,自动使用 flow-engine 命名空间
|
|
15
15
|
*/
|
|
16
16
|
export declare function getT(model: FlowModel): (key: string, options?: any) => string;
|
|
17
|
+
export declare function tExpr(text: TFuncKey | TFuncKey[], options?: TOptions): string;
|
|
18
|
+
/**
|
|
19
|
+
* @deprecated use tExpr from `@nocobase/flow-engine` instead
|
|
20
|
+
*/
|
|
17
21
|
export declare function escapeT(text: TFuncKey | TFuncKey[], options?: TOptions): string;
|
|
18
|
-
export { escapeT as tExpr };
|
package/lib/utils/translation.js
CHANGED
|
@@ -29,7 +29,7 @@ var translation_exports = {};
|
|
|
29
29
|
__export(translation_exports, {
|
|
30
30
|
escapeT: () => escapeT,
|
|
31
31
|
getT: () => getT,
|
|
32
|
-
tExpr: () =>
|
|
32
|
+
tExpr: () => tExpr
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(translation_exports);
|
|
35
35
|
var import_constants = require("./constants");
|
|
@@ -43,12 +43,16 @@ function getT(model) {
|
|
|
43
43
|
return (key) => key;
|
|
44
44
|
}
|
|
45
45
|
__name(getT, "getT");
|
|
46
|
-
function
|
|
46
|
+
function tExpr(text, options) {
|
|
47
47
|
if (options) {
|
|
48
48
|
return `{{t(${JSON.stringify(text)}, ${JSON.stringify(options)})}}`;
|
|
49
49
|
}
|
|
50
50
|
return `{{t(${JSON.stringify(text)})}}`;
|
|
51
51
|
}
|
|
52
|
+
__name(tExpr, "tExpr");
|
|
53
|
+
function escapeT(text, options) {
|
|
54
|
+
return tExpr(text, options);
|
|
55
|
+
}
|
|
52
56
|
__name(escapeT, "escapeT");
|
|
53
57
|
// Annotate the CommonJS export names for ESM import in node:
|
|
54
58
|
0 && (module.exports = {
|