@nocobase/flow-engine 2.0.0-alpha.4 → 2.0.0-alpha.40
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 +90 -0
- package/lib/FlowContextProvider.d.ts +2 -2
- package/lib/FlowContextProvider.js +3 -3
- package/lib/FlowDefinition.d.ts +4 -2
- package/lib/JSRunner.js +3 -0
- package/lib/ViewScopedFlowEngine.d.ts +1 -1
- package/lib/ViewScopedFlowEngine.js +12 -0
- package/lib/acl/Acl.d.ts +1 -0
- package/lib/acl/Acl.js +11 -0
- package/lib/components/FieldModelRenderer.js +14 -6
- package/lib/components/FieldSkeleton.d.ts +10 -0
- package/lib/components/FieldSkeleton.js +64 -0
- package/lib/components/FlowContextSelector.js +7 -2
- package/lib/components/FlowModelRenderer.d.ts +3 -6
- package/lib/components/FlowModelRenderer.js +16 -47
- 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/index.d.ts +1 -0
- package/lib/components/index.js +3 -1
- package/lib/components/settings/independents/dropdown/FlowsDropdownButton.js +2 -2
- package/lib/components/settings/wrappers/contextual/DefaultSettingsIcon.js +17 -5
- package/lib/components/settings/wrappers/contextual/FlowsContextMenu.js +2 -2
- package/lib/components/settings/wrappers/contextual/FlowsFloatContextMenu.d.ts +2 -2
- package/lib/components/settings/wrappers/contextual/FlowsFloatContextMenu.js +35 -6
- package/lib/components/settings/wrappers/contextual/StepSettingsDialog.js +7 -1
- package/lib/components/variables/VariableInput.js +19 -5
- package/lib/components/variables/VariableTag.js +43 -2
- package/lib/components/variables/types.d.ts +2 -0
- package/lib/data-source/index.d.ts +15 -4
- package/lib/data-source/index.js +42 -13
- package/lib/data-source/sortCollectionsByInherits.d.ts +10 -0
- package/lib/data-source/sortCollectionsByInherits.js +71 -0
- package/lib/emitter.d.ts +6 -0
- package/lib/emitter.js +12 -0
- package/lib/executor/FlowExecutor.d.ts +4 -5
- package/lib/executor/FlowExecutor.js +168 -99
- 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 +37 -5
- package/lib/flowContext.js +215 -87
- package/lib/flowEngine.d.ts +24 -1
- package/lib/flowEngine.js +56 -6
- package/lib/flowSettings.d.ts +2 -1
- package/lib/flowSettings.js +12 -8
- package/lib/hooks/useApplyAutoFlows.js +2 -1
- package/lib/index.d.ts +7 -1
- package/lib/index.js +32 -3
- package/lib/locale/en-US.json +4 -2
- package/lib/locale/index.d.ts +4 -0
- package/lib/locale/zh-CN.json +4 -2
- package/lib/models/CollectionFieldModel.d.ts +3 -0
- package/lib/models/CollectionFieldModel.js +48 -5
- package/lib/models/flowModel.d.ts +30 -29
- package/lib/models/flowModel.js +135 -98
- package/lib/models/forkFlowModel.d.ts +8 -4
- package/lib/models/forkFlowModel.js +38 -8
- package/lib/provider.d.ts +3 -1
- package/lib/provider.js +7 -5
- package/lib/resources/multiRecordResource.js +25 -1
- package/lib/resources/singleRecordResource.js +19 -1
- package/lib/resources/sqlResource.d.ts +1 -0
- package/lib/resources/sqlResource.js +20 -24
- package/lib/runjs-context/contexts/FormJSFieldItemRunJSContext.d.ts +1 -6
- package/lib/runjs-context/contexts/FormJSFieldItemRunJSContext.js +27 -20
- package/lib/runjs-context/contexts/JSBlockRunJSContext.d.ts +1 -6
- package/lib/runjs-context/contexts/JSBlockRunJSContext.js +46 -33
- package/lib/runjs-context/contexts/JSCollectionActionRunJSContext.d.ts +1 -2
- package/lib/runjs-context/contexts/JSCollectionActionRunJSContext.js +14 -15
- package/lib/runjs-context/contexts/{LinkageRunJSContext.d.ts → JSColumnRunJSContext.d.ts} +6 -3
- package/lib/runjs-context/contexts/JSColumnRunJSContext.js +78 -0
- package/lib/runjs-context/contexts/JSFieldRunJSContext.d.ts +1 -6
- package/lib/runjs-context/contexts/JSFieldRunJSContext.js +28 -24
- package/lib/runjs-context/contexts/JSItemRunJSContext.d.ts +1 -6
- package/lib/runjs-context/contexts/JSItemRunJSContext.js +24 -20
- package/lib/runjs-context/contexts/JSRecordActionRunJSContext.d.ts +1 -2
- package/lib/runjs-context/contexts/JSRecordActionRunJSContext.js +16 -17
- package/lib/runjs-context/contexts/base.d.ts +9 -0
- package/lib/runjs-context/contexts/base.js +183 -0
- package/lib/runjs-context/helpers.d.ts +5 -2
- package/lib/runjs-context/helpers.js +36 -27
- package/lib/runjs-context/registry.d.ts +7 -4
- package/lib/runjs-context/registry.js +10 -42
- package/lib/runjs-context/setup.d.ts +9 -0
- package/lib/runjs-context/setup.js +82 -0
- package/lib/runjs-context/snippets/global/{copy-record-json.snippet.js → api-request.snippet.js} +25 -10
- package/lib/runjs-context/snippets/global/clipboard-copy-text.snippet.js +61 -0
- package/lib/runjs-context/snippets/global/{view-navigation-push.snippet.js → import-esm.snippet.js} +26 -12
- package/lib/runjs-context/snippets/global/message-error.snippet.js +6 -0
- package/lib/runjs-context/snippets/global/message-success.snippet.js +6 -0
- package/lib/runjs-context/snippets/global/notification-open.snippet.d.ts +3 -8
- package/lib/runjs-context/snippets/global/notification-open.snippet.js +8 -1
- package/lib/runjs-context/snippets/global/open-view-dialog.snippet.js +10 -3
- package/lib/runjs-context/snippets/global/open-view-drawer.snippet.js +10 -3
- package/lib/runjs-context/snippets/global/query-selector.snippet.js +53 -0
- package/lib/runjs-context/snippets/global/require-amd.snippet.d.ts +11 -0
- package/lib/runjs-context/snippets/global/{requireAsync.snippet.js → require-amd.snippet.js} +16 -13
- package/lib/runjs-context/snippets/global/window-open.snippet.d.ts +3 -8
- package/lib/runjs-context/snippets/global/window-open.snippet.js +8 -1
- package/lib/runjs-context/snippets/index.d.ts +14 -3
- package/lib/runjs-context/snippets/index.js +161 -40
- package/lib/runjs-context/snippets/scene/block/add-event-listener.snippet.d.ts +11 -0
- package/lib/runjs-context/snippets/scene/{jsblock → block}/add-event-listener.snippet.js +11 -2
- package/lib/runjs-context/snippets/scene/block/api-fetch-render-list.snippet.d.ts +11 -0
- package/lib/runjs-context/snippets/scene/block/api-fetch-render-list.snippet.js +64 -0
- package/lib/runjs-context/snippets/scene/block/chartjs-bar.snippet.d.ts +11 -0
- package/lib/runjs-context/snippets/scene/block/chartjs-bar.snippet.js +99 -0
- package/lib/runjs-context/snippets/{libs → scene/block}/echarts-init.snippet.js +24 -7
- package/lib/runjs-context/snippets/scene/block/render-button-handler.snippet.d.ts +11 -0
- package/lib/runjs-context/snippets/scene/{jsblock → block}/render-button-handler.snippet.js +17 -9
- package/lib/runjs-context/snippets/scene/block/render-iframe.snippet.d.ts +11 -0
- package/lib/runjs-context/snippets/scene/block/render-iframe.snippet.js +57 -0
- package/lib/runjs-context/snippets/scene/block/render-info-card.snippet.d.ts +11 -0
- package/lib/runjs-context/snippets/scene/block/render-info-card.snippet.js +71 -0
- package/lib/runjs-context/snippets/scene/block/render-react-jsx.snippet.d.ts +11 -0
- package/lib/runjs-context/snippets/scene/{jsblock/render-card.snippet.js → block/render-react-jsx.snippet.js} +26 -13
- package/lib/runjs-context/snippets/scene/block/render-react.snippet.d.ts +11 -0
- package/lib/runjs-context/snippets/scene/{jsblock → block}/render-react.snippet.js +18 -17
- package/lib/runjs-context/snippets/scene/block/render-statistics.snippet.d.ts +11 -0
- package/lib/runjs-context/snippets/scene/block/render-statistics.snippet.js +95 -0
- package/lib/runjs-context/snippets/scene/block/render-timeline.snippet.d.ts +11 -0
- package/lib/runjs-context/snippets/scene/block/render-timeline.snippet.js +84 -0
- package/lib/runjs-context/snippets/scene/block/resource-example.snippet.d.ts +11 -0
- package/lib/runjs-context/snippets/scene/block/resource-example.snippet.js +60 -0
- package/lib/runjs-context/snippets/scene/block/three-users-orbit.snippet.d.ts +11 -0
- package/lib/runjs-context/snippets/scene/block/three-users-orbit.snippet.js +283 -0
- package/lib/runjs-context/snippets/scene/block/vue-component.snippet.d.ts +11 -0
- package/lib/runjs-context/snippets/scene/block/vue-component.snippet.js +124 -0
- package/lib/runjs-context/snippets/scene/detail/color-by-value.snippet.d.ts +11 -0
- package/lib/runjs-context/snippets/scene/{jsfield → detail}/color-by-value.snippet.js +13 -3
- package/lib/runjs-context/snippets/scene/detail/copy-to-clipboard.snippet.d.ts +11 -0
- package/lib/runjs-context/snippets/{global → scene/detail}/copy-to-clipboard.snippet.js +28 -6
- package/lib/runjs-context/snippets/scene/detail/format-number.snippet.d.ts +11 -0
- package/lib/runjs-context/snippets/scene/{jsfield → detail}/format-number.snippet.js +13 -3
- package/lib/runjs-context/snippets/scene/detail/innerHTML-value.snippet.d.ts +11 -0
- package/lib/runjs-context/snippets/scene/{jsfield → detail}/innerHTML-value.snippet.js +13 -3
- package/lib/runjs-context/snippets/scene/detail/percentage-bar.snippet.d.ts +11 -0
- package/lib/runjs-context/snippets/scene/detail/percentage-bar.snippet.js +82 -0
- package/lib/runjs-context/snippets/scene/detail/relative-time.snippet.d.ts +11 -0
- package/lib/runjs-context/snippets/scene/detail/relative-time.snippet.js +80 -0
- package/lib/runjs-context/snippets/scene/detail/status-tag.snippet.d.ts +11 -0
- package/lib/runjs-context/snippets/scene/detail/status-tag.snippet.js +74 -0
- package/lib/runjs-context/snippets/scene/form/calculate-total.snippet.d.ts +11 -0
- package/lib/runjs-context/snippets/scene/form/calculate-total.snippet.js +63 -0
- package/lib/runjs-context/snippets/scene/form/cascade-select.snippet.d.ts +11 -0
- package/lib/runjs-context/snippets/scene/form/cascade-select.snippet.js +81 -0
- package/lib/runjs-context/snippets/scene/form/conditional-required.snippet.d.ts +11 -0
- package/lib/runjs-context/snippets/scene/form/conditional-required.snippet.js +64 -0
- package/lib/runjs-context/snippets/scene/form/copy-field-values.snippet.d.ts +11 -0
- package/lib/runjs-context/snippets/scene/form/copy-field-values.snippet.js +74 -0
- package/lib/runjs-context/snippets/scene/form/render-basic.snippet.d.ts +11 -0
- package/lib/runjs-context/snippets/scene/{jsitem → form}/render-basic.snippet.js +11 -2
- package/lib/runjs-context/snippets/scene/form/set-disabled.snippet.d.ts +11 -0
- package/lib/runjs-context/snippets/scene/{linkage → form}/set-disabled.snippet.js +12 -3
- package/lib/runjs-context/snippets/scene/form/set-field-value.snippet.d.ts +11 -0
- package/lib/runjs-context/snippets/scene/{linkage → form}/set-field-value.snippet.js +12 -3
- package/lib/runjs-context/snippets/scene/form/set-required.snippet.d.ts +11 -0
- package/lib/runjs-context/snippets/scene/{linkage → form}/set-required.snippet.js +12 -3
- package/lib/runjs-context/snippets/scene/form/toggle-multiple-fields.snippet.d.ts +11 -0
- package/lib/runjs-context/snippets/scene/form/toggle-multiple-fields.snippet.js +67 -0
- package/lib/runjs-context/snippets/scene/form/toggle-visible.snippet.d.ts +11 -0
- package/lib/runjs-context/snippets/scene/{linkage → form}/toggle-visible.snippet.js +12 -3
- package/lib/runjs-context/snippets/scene/table/cell-open-dialog.snippet.d.ts +11 -0
- package/lib/runjs-context/snippets/scene/table/cell-open-dialog.snippet.js +64 -0
- package/lib/runjs-context/snippets/scene/table/collection-selected-count.snippet.d.ts +11 -0
- package/lib/runjs-context/snippets/scene/{actions → table}/collection-selected-count.snippet.js +11 -2
- package/lib/runjs-context/snippets/scene/table/concat-fields.snippet.d.ts +11 -0
- package/lib/runjs-context/snippets/scene/table/concat-fields.snippet.js +79 -0
- package/lib/runjs-context/snippets/scene/table/destroy-selected.snippet.d.ts +11 -0
- package/lib/runjs-context/snippets/{global/log-json-record.snippet.js → scene/table/destroy-selected.snippet.js} +24 -11
- package/lib/runjs-context/snippets/scene/table/export-selected-json.snippet.d.ts +11 -0
- package/lib/runjs-context/snippets/scene/table/export-selected-json.snippet.js +64 -0
- package/lib/runjs-context/snippets/scene/table/iterate-selected-rows.snippet.d.ts +11 -0
- package/lib/runjs-context/snippets/scene/{actions → table}/iterate-selected-rows.snippet.js +11 -2
- package/lib/runjs-context/snippets/types.d.ts +9 -1
- package/lib/scheduler/ModelOperationScheduler.d.ts +51 -0
- package/lib/scheduler/ModelOperationScheduler.js +262 -0
- package/lib/types.d.ts +28 -3
- package/lib/types.js +4 -3
- package/lib/utils/associationObjectVariable.d.ts +32 -0
- package/lib/utils/associationObjectVariable.js +157 -0
- package/lib/utils/buildSettingsViewInputArgs.d.ts +19 -0
- package/lib/utils/buildSettingsViewInputArgs.js +75 -0
- 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/{runjs-context/snippets/global/api-request-post.snippet.js → utils/flows.js} +21 -15
- package/lib/utils/index.d.ts +7 -2
- package/lib/utils/index.js +19 -2
- 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/{runjs-context/snippets/global/try-catch-async.snippet.js → utils/pruneFilter.js} +24 -16
- package/lib/utils/safeGlobals.d.ts +5 -3
- package/lib/utils/safeGlobals.js +40 -0
- package/lib/utils/schema-utils.js +2 -2
- package/lib/utils/serverContextParams.d.ts +1 -0
- package/lib/utils/translation.d.ts +4 -1
- package/lib/utils/translation.js +6 -2
- package/lib/utils/variablesParams.d.ts +9 -5
- package/lib/utils/variablesParams.js +47 -36
- package/lib/views/DrawerComponent.js +21 -2
- package/lib/views/PageComponent.js +2 -1
- package/lib/views/ViewNavigation.d.ts +3 -9
- package/lib/views/ViewNavigation.js +16 -2
- package/lib/views/createViewMeta.d.ts +29 -1
- package/lib/views/createViewMeta.js +338 -72
- package/lib/views/index.d.ts +1 -0
- package/lib/views/index.js +3 -0
- package/lib/views/useDialog.d.ts +8 -8
- package/lib/views/useDialog.js +8 -7
- package/lib/views/useDrawer.d.ts +8 -8
- package/lib/views/useDrawer.js +43 -28
- package/lib/views/usePage.d.ts +8 -8
- package/lib/views/usePage.js +8 -7
- package/package.json +6 -3
- package/src/BlockScopedFlowEngine.ts +86 -0
- package/src/FlowContextProvider.tsx +4 -2
- package/src/JSRunner.ts +3 -0
- package/src/ViewScopedFlowEngine.ts +15 -1
- package/src/__tests__/JSRunner.test.ts +62 -53
- package/src/__tests__/blockScopedFlowEngine.test.ts +154 -0
- package/src/__tests__/createViewMeta.popup.test.ts +132 -0
- package/src/__tests__/flow-engine.test.ts +3 -0
- package/src/__tests__/flowContext.test.ts +52 -0
- package/src/__tests__/flowContextCreateJSRunner.test.ts +163 -0
- package/src/__tests__/flowEngine.saveModel.test.ts +4 -0
- package/src/__tests__/flowRunJSContextDefine.test.ts +508 -0
- 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__/runjsContext.test.ts +216 -35
- package/src/__tests__/runjsContextImplementations.test.ts +217 -0
- package/src/__tests__/runjsContextRuntime.test.ts +269 -0
- package/src/__tests__/runjsEdgeCases.test.ts +281 -0
- package/src/__tests__/runjsLocales.test.ts +36 -0
- package/src/__tests__/runjsRuntimeFeatures.test.ts +449 -0
- package/src/__tests__/runjsSnippets.test.ts +140 -0
- package/src/__tests__/viewScopedFlowEngine.test.ts +3 -3
- package/src/acl/Acl.tsx +14 -0
- package/src/acl/__tests__/Acl.test.tsx +43 -0
- package/src/components/DynamicFlowsEditor.tsx +3 -4
- package/src/components/FieldModelRenderer.tsx +20 -7
- package/src/components/FieldSkeleton.tsx +27 -0
- package/src/components/FlowContextSelector.tsx +6 -2
- package/src/components/FlowModelRenderer.tsx +33 -81
- 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__/flow-model-render-error-fallback.test.tsx +6 -6
- package/src/components/index.ts +1 -0
- package/src/components/settings/independents/dropdown/FlowsDropdownButton.tsx +1 -1
- package/src/components/settings/wrappers/contextual/DefaultSettingsIcon.tsx +17 -4
- package/src/components/settings/wrappers/contextual/FlowsContextMenu.tsx +1 -1
- package/src/components/settings/wrappers/contextual/FlowsFloatContextMenu.tsx +39 -10
- package/src/components/settings/wrappers/contextual/StepSettingsDialog.tsx +14 -1
- package/src/components/settings/wrappers/contextual/__tests__/DefaultSettingsIcon.test.tsx +425 -0
- package/src/components/subModel/__tests__/AddSubModelButton.test.tsx +5 -7
- package/src/components/variables/VariableInput.tsx +25 -5
- package/src/components/variables/VariableTag.tsx +54 -2
- package/src/components/variables/types.ts +2 -0
- package/src/data-source/__tests__/sortCollectionsByInherits.test.ts +125 -0
- package/src/data-source/index.ts +42 -11
- package/src/data-source/sortCollectionsByInherits.ts +61 -0
- package/src/emitter.ts +14 -0
- package/src/executor/FlowExecutor.ts +213 -119
- package/src/executor/__tests__/ctx-defs-injection.test.ts +197 -0
- package/src/executor/__tests__/flowExecutor.test.ts +151 -5
- 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 +290 -104
- package/src/flowEngine.ts +74 -6
- package/src/flowSettings.ts +9 -4
- package/src/hooks/useApplyAutoFlows.ts +3 -1
- package/src/index.ts +12 -1
- package/src/locale/en-US.json +4 -2
- package/src/locale/zh-CN.json +4 -2
- package/src/models/CollectionFieldModel.tsx +56 -7
- package/src/models/__tests__/dispatchEvent.behavior.test.ts +169 -0
- package/src/models/__tests__/flowModel.getFlows.sort.test.ts +33 -9
- package/src/models/__tests__/flowModel.scheduleModelOperation.test.tsx +129 -0
- package/src/models/__tests__/flowModel.test.ts +234 -111
- package/src/models/__tests__/forkFlowModel.test.ts +40 -7
- package/src/models/flowModel.tsx +180 -132
- package/src/models/forkFlowModel.ts +48 -8
- package/src/provider.tsx +10 -7
- package/src/resources/multiRecordResource.ts +28 -1
- package/src/resources/singleRecordResource.ts +19 -1
- package/src/resources/sqlResource.ts +20 -25
- package/src/runjs-context/contexts/FormJSFieldItemRunJSContext.ts +28 -21
- package/src/runjs-context/contexts/JSBlockRunJSContext.ts +46 -34
- package/src/runjs-context/contexts/JSCollectionActionRunJSContext.ts +15 -16
- package/src/runjs-context/contexts/JSColumnRunJSContext.ts +58 -0
- package/src/runjs-context/contexts/JSFieldRunJSContext.ts +30 -25
- package/src/runjs-context/contexts/JSItemRunJSContext.ts +25 -21
- package/src/runjs-context/contexts/JSRecordActionRunJSContext.ts +17 -18
- package/src/runjs-context/contexts/base.ts +171 -0
- package/src/runjs-context/helpers.ts +32 -30
- package/src/runjs-context/registry.ts +16 -47
- package/src/runjs-context/setup.ts +51 -0
- package/src/runjs-context/snippets/global/api-request.snippet.ts +38 -0
- package/src/runjs-context/snippets/global/clipboard-copy-text.snippet.ts +42 -0
- package/src/runjs-context/snippets/global/import-esm.snippet.ts +39 -0
- package/src/runjs-context/snippets/global/message-error.snippet.ts +6 -0
- package/src/runjs-context/snippets/global/message-success.snippet.ts +6 -0
- package/src/runjs-context/snippets/global/notification-open.snippet.ts +11 -1
- package/src/runjs-context/snippets/global/open-view-dialog.snippet.ts +10 -3
- package/src/runjs-context/snippets/global/open-view-drawer.snippet.ts +10 -3
- package/src/runjs-context/snippets/global/query-selector.snippet.ts +34 -0
- package/src/runjs-context/snippets/global/require-amd.snippet.ts +30 -0
- package/src/runjs-context/snippets/global/window-open.snippet.ts +11 -1
- package/src/runjs-context/snippets/index.ts +177 -39
- package/src/runjs-context/snippets/scene/{jsblock → block}/add-event-listener.snippet.ts +14 -2
- package/src/runjs-context/snippets/scene/block/api-fetch-render-list.snippet.ts +45 -0
- package/src/runjs-context/snippets/scene/block/chartjs-bar.snippet.ts +80 -0
- package/src/runjs-context/snippets/scene/block/echarts-init.snippet.ts +44 -0
- package/src/runjs-context/snippets/scene/block/render-button-handler.snippet.ts +35 -0
- package/src/runjs-context/snippets/scene/block/render-iframe.snippet.ts +38 -0
- package/src/runjs-context/snippets/scene/block/render-info-card.snippet.ts +52 -0
- 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 +38 -0
- package/src/runjs-context/snippets/scene/block/render-statistics.snippet.ts +76 -0
- package/src/runjs-context/snippets/scene/block/render-timeline.snippet.ts +65 -0
- package/src/runjs-context/snippets/scene/block/resource-example.snippet.ts +46 -0
- package/src/runjs-context/snippets/scene/block/three-users-orbit.snippet.ts +264 -0
- package/src/runjs-context/snippets/scene/block/vue-component.snippet.ts +105 -0
- package/src/runjs-context/snippets/scene/detail/color-by-value.snippet.ts +33 -0
- package/src/runjs-context/snippets/scene/detail/copy-to-clipboard.snippet.ts +45 -0
- package/src/runjs-context/snippets/scene/detail/format-number.snippet.ts +32 -0
- package/src/runjs-context/snippets/scene/detail/innerHTML-value.snippet.ts +31 -0
- package/src/runjs-context/snippets/scene/detail/percentage-bar.snippet.ts +63 -0
- package/src/runjs-context/snippets/scene/detail/relative-time.snippet.ts +61 -0
- package/src/runjs-context/snippets/scene/detail/status-tag.snippet.ts +55 -0
- package/src/runjs-context/snippets/scene/form/calculate-total.snippet.ts +44 -0
- package/src/runjs-context/snippets/scene/form/cascade-select.snippet.ts +62 -0
- package/src/runjs-context/snippets/scene/form/conditional-required.snippet.ts +45 -0
- package/src/runjs-context/snippets/scene/form/copy-field-values.snippet.ts +55 -0
- package/src/runjs-context/snippets/scene/{jsitem → form}/render-basic.snippet.ts +14 -2
- package/src/runjs-context/snippets/scene/{linkage → form}/set-disabled.snippet.ts +15 -3
- package/src/runjs-context/snippets/scene/{linkage → form}/set-field-value.snippet.ts +15 -3
- package/src/runjs-context/snippets/scene/{linkage → form}/set-required.snippet.ts +15 -3
- package/src/runjs-context/snippets/scene/form/toggle-multiple-fields.snippet.ts +48 -0
- package/src/runjs-context/snippets/scene/{linkage → form}/toggle-visible.snippet.ts +15 -3
- package/src/runjs-context/snippets/scene/table/cell-open-dialog.snippet.ts +45 -0
- package/src/runjs-context/snippets/scene/{actions → table}/collection-selected-count.snippet.ts +14 -2
- package/src/runjs-context/snippets/scene/table/concat-fields.snippet.ts +60 -0
- package/src/runjs-context/snippets/scene/table/destroy-selected.snippet.ts +36 -0
- package/src/runjs-context/snippets/scene/table/export-selected-json.snippet.ts +45 -0
- package/src/runjs-context/snippets/scene/{actions → table}/iterate-selected-rows.snippet.ts +14 -2
- package/src/runjs-context/snippets/types.ts +5 -1
- package/src/scheduler/ModelOperationScheduler.ts +304 -0
- package/src/types.ts +34 -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 +22 -1
- package/src/utils/associationObjectVariable.ts +180 -0
- package/src/utils/buildSettingsViewInputArgs.ts +72 -0
- package/src/utils/createEphemeralContext.ts +142 -0
- package/src/utils/flows.ts +23 -0
- package/src/utils/index.ts +10 -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 +49 -3
- package/src/utils/schema-utils.ts +1 -1
- package/src/utils/serverContextParams.ts +1 -0
- package/src/utils/translation.ts +7 -2
- package/src/utils/variablesParams.ts +50 -38
- package/src/views/DrawerComponent.tsx +21 -2
- package/src/views/PageComponent.tsx +1 -1
- package/src/views/ViewNavigation.ts +20 -12
- package/src/views/__tests__/ViewNavigation.test.ts +10 -0
- package/src/views/createViewMeta.ts +393 -70
- package/src/views/index.tsx +1 -0
- package/src/views/useDialog.tsx +12 -10
- package/src/views/useDrawer.tsx +62 -37
- package/src/views/usePage.tsx +13 -10
- package/lib/runjs-context/contexts/FlowRunJSContext.d.ts +0 -38
- package/lib/runjs-context/contexts/FlowRunJSContext.js +0 -217
- package/lib/runjs-context/contexts/LinkageRunJSContext.js +0 -62
- package/lib/runjs-context/index.d.ts +0 -19
- package/lib/runjs-context/index.js +0 -57
- package/lib/runjs-context/snippets/global/api-request-get.snippet.d.ts +0 -16
- package/lib/runjs-context/snippets/global/api-request-get.snippet.js +0 -42
- package/lib/runjs-context/snippets/global/api-request-post.snippet.d.ts +0 -16
- package/lib/runjs-context/snippets/global/console-log-ctx.snippet.d.ts +0 -16
- package/lib/runjs-context/snippets/global/console-log-ctx.snippet.js +0 -41
- package/lib/runjs-context/snippets/global/requireAsync.snippet.d.ts +0 -16
- package/lib/runjs-context/snippets/global/sleep.snippet.d.ts +0 -16
- package/lib/runjs-context/snippets/global/sleep.snippet.js +0 -43
- package/lib/runjs-context/snippets/global/try-catch-async.snippet.d.ts +0 -16
- package/lib/runjs-context/snippets/libs/echarts-init.snippet.d.ts +0 -15
- package/lib/runjs-context/snippets/scene/actions/collection-selected-count.snippet.d.ts +0 -15
- package/lib/runjs-context/snippets/scene/actions/iterate-selected-rows.snippet.d.ts +0 -15
- package/lib/runjs-context/snippets/scene/actions/record-id-message.snippet.d.ts +0 -15
- package/lib/runjs-context/snippets/scene/actions/record-id-message.snippet.js +0 -43
- package/lib/runjs-context/snippets/scene/actions/run-action-basic.snippet.d.ts +0 -15
- package/lib/runjs-context/snippets/scene/actions/run-action-basic.snippet.js +0 -40
- package/lib/runjs-context/snippets/scene/jsblock/add-event-listener.snippet.d.ts +0 -15
- package/lib/runjs-context/snippets/scene/jsblock/append-style.snippet.d.ts +0 -15
- package/lib/runjs-context/snippets/scene/jsblock/append-style.snippet.js +0 -42
- package/lib/runjs-context/snippets/scene/jsblock/jsx-mount.snippet.d.ts +0 -15
- package/lib/runjs-context/snippets/scene/jsblock/jsx-mount.snippet.js +0 -46
- package/lib/runjs-context/snippets/scene/jsblock/jsx-unmount.snippet.d.ts +0 -15
- package/lib/runjs-context/snippets/scene/jsblock/jsx-unmount.snippet.js +0 -41
- package/lib/runjs-context/snippets/scene/jsblock/render-basic.snippet.d.ts +0 -15
- package/lib/runjs-context/snippets/scene/jsblock/render-basic.snippet.js +0 -41
- package/lib/runjs-context/snippets/scene/jsblock/render-button-handler.snippet.d.ts +0 -15
- package/lib/runjs-context/snippets/scene/jsblock/render-react.snippet.d.ts +0 -15
- package/lib/runjs-context/snippets/scene/jsfield/color-by-value.snippet.d.ts +0 -15
- package/lib/runjs-context/snippets/scene/jsfield/format-number.snippet.d.ts +0 -15
- package/lib/runjs-context/snippets/scene/jsfield/innerHTML-value.snippet.d.ts +0 -15
- package/lib/runjs-context/snippets/scene/jsitem/render-basic.snippet.d.ts +0 -15
- package/lib/runjs-context/snippets/scene/linkage/set-disabled.snippet.d.ts +0 -15
- package/lib/runjs-context/snippets/scene/linkage/set-field-value.snippet.d.ts +0 -15
- package/lib/runjs-context/snippets/scene/linkage/set-required.snippet.d.ts +0 -15
- package/lib/runjs-context/snippets/scene/linkage/toggle-visible.snippet.d.ts +0 -15
- package/src/runjs-context/contexts/FlowRunJSContext.ts +0 -190
- package/src/runjs-context/contexts/LinkageRunJSContext.ts +0 -35
- package/src/runjs-context/index.ts +0 -20
- package/src/runjs-context/snippets/global/api-request-get.snippet.ts +0 -20
- package/src/runjs-context/snippets/global/api-request-post.snippet.ts +0 -20
- package/src/runjs-context/snippets/global/console-log-ctx.snippet.ts +0 -19
- package/src/runjs-context/snippets/global/copy-record-json.snippet.ts +0 -21
- package/src/runjs-context/snippets/global/copy-to-clipboard.snippet.ts +0 -21
- package/src/runjs-context/snippets/global/log-json-record.snippet.ts +0 -21
- package/src/runjs-context/snippets/global/requireAsync.snippet.ts +0 -24
- package/src/runjs-context/snippets/global/sleep.snippet.ts +0 -21
- package/src/runjs-context/snippets/global/try-catch-async.snippet.ts +0 -22
- package/src/runjs-context/snippets/global/view-navigation-push.snippet.ts +0 -23
- package/src/runjs-context/snippets/libs/echarts-init.snippet.ts +0 -24
- package/src/runjs-context/snippets/scene/actions/record-id-message.snippet.ts +0 -21
- package/src/runjs-context/snippets/scene/actions/run-action-basic.snippet.ts +0 -18
- package/src/runjs-context/snippets/scene/jsblock/append-style.snippet.ts +0 -20
- package/src/runjs-context/snippets/scene/jsblock/jsx-mount.snippet.ts +0 -24
- package/src/runjs-context/snippets/scene/jsblock/jsx-unmount.snippet.ts +0 -19
- package/src/runjs-context/snippets/scene/jsblock/render-basic.snippet.ts +0 -24
- package/src/runjs-context/snippets/scene/jsblock/render-button-handler.snippet.ts +0 -24
- package/src/runjs-context/snippets/scene/jsblock/render-card.snippet.ts +0 -30
- package/src/runjs-context/snippets/scene/jsblock/render-react.snippet.ts +0 -34
- package/src/runjs-context/snippets/scene/jsfield/color-by-value.snippet.ts +0 -20
- package/src/runjs-context/snippets/scene/jsfield/format-number.snippet.ts +0 -19
- package/src/runjs-context/snippets/scene/jsfield/innerHTML-value.snippet.ts +0 -18
- /package/lib/runjs-context/snippets/global/{copy-record-json.snippet.d.ts → api-request.snippet.d.ts} +0 -0
- /package/lib/runjs-context/snippets/global/{copy-to-clipboard.snippet.d.ts → clipboard-copy-text.snippet.d.ts} +0 -0
- /package/lib/runjs-context/snippets/global/{log-json-record.snippet.d.ts → import-esm.snippet.d.ts} +0 -0
- /package/lib/runjs-context/snippets/global/{view-navigation-push.snippet.d.ts → query-selector.snippet.d.ts} +0 -0
- /package/lib/runjs-context/snippets/scene/{jsblock/render-card.snippet.d.ts → block/echarts-init.snippet.d.ts} +0 -0
package/lib/flowSettings.js
CHANGED
|
@@ -152,7 +152,7 @@ const _FlowSettings = class _FlowSettings {
|
|
|
152
152
|
TreeSelect,
|
|
153
153
|
Upload
|
|
154
154
|
} = await import("@formily/antd-v5");
|
|
155
|
-
const { Button: Button2 } = await import("antd");
|
|
155
|
+
const { Button: Button2, Alert } = await import("antd");
|
|
156
156
|
this.components.Form = Form;
|
|
157
157
|
this.components.FormDialog = FormDialog;
|
|
158
158
|
this.components.FormDrawer = FormDrawer;
|
|
@@ -186,6 +186,7 @@ const _FlowSettings = class _FlowSettings {
|
|
|
186
186
|
this.components.Space = Space2;
|
|
187
187
|
this.components.Editable = Editable;
|
|
188
188
|
this.components.PreviewText = PreviewText;
|
|
189
|
+
this.components.Alert = Alert;
|
|
189
190
|
this.components.Button = Button2;
|
|
190
191
|
this.components.Submit = Submit;
|
|
191
192
|
this.components.Reset = Reset;
|
|
@@ -376,7 +377,8 @@ const _FlowSettings = class _FlowSettings {
|
|
|
376
377
|
initialValues,
|
|
377
378
|
flowEngine,
|
|
378
379
|
form,
|
|
379
|
-
onFormValuesChange: onFormValuesChange2
|
|
380
|
+
onFormValuesChange: onFormValuesChange2,
|
|
381
|
+
key
|
|
380
382
|
}) {
|
|
381
383
|
var _a, _b;
|
|
382
384
|
const scopes = {
|
|
@@ -399,7 +401,7 @@ const _FlowSettings = class _FlowSettings {
|
|
|
399
401
|
const SchemaField = (0, import_react.createSchemaField)();
|
|
400
402
|
return import_react2.default.createElement(
|
|
401
403
|
FormProviderWithForm,
|
|
402
|
-
{ form, initialValues, onFormValuesChange: onFormValuesChange2 },
|
|
404
|
+
{ form, initialValues, onFormValuesChange: onFormValuesChange2, key },
|
|
403
405
|
import_react2.default.createElement(SchemaField, {
|
|
404
406
|
schema: compiledSchema,
|
|
405
407
|
components: ((_b = flowEngine == null ? void 0 : flowEngine.flowSettings) == null ? void 0 : _b.components) || {},
|
|
@@ -436,7 +438,7 @@ const _FlowSettings = class _FlowSettings {
|
|
|
436
438
|
* @returns {Promise<boolean>} 是否成功打开弹窗
|
|
437
439
|
*/
|
|
438
440
|
async open(options) {
|
|
439
|
-
var _a, _b, _c, _d, _e
|
|
441
|
+
var _a, _b, _c, _d, _e;
|
|
440
442
|
__privateGet(this, _emitter).emit("beforeOpen", options);
|
|
441
443
|
const { model, flowKey, flowKeys, stepKey, uiMode = "dialog", preset, onCancel, onSaved } = options;
|
|
442
444
|
if (!model) {
|
|
@@ -471,7 +473,7 @@ const _FlowSettings = class _FlowSettings {
|
|
|
471
473
|
let actionDefaultParams = {};
|
|
472
474
|
let uiMode2;
|
|
473
475
|
if (step.use) {
|
|
474
|
-
const action = (
|
|
476
|
+
const action = (_b = model.getAction) == null ? void 0 : _b.call(model, step.use);
|
|
475
477
|
if (action) {
|
|
476
478
|
actionDefaultParams = action.defaultParams || {};
|
|
477
479
|
stepTitle = stepTitle || action.title;
|
|
@@ -509,7 +511,7 @@ const _FlowSettings = class _FlowSettings {
|
|
|
509
511
|
}
|
|
510
512
|
if (entries.length === 0) {
|
|
511
513
|
if (!preset) {
|
|
512
|
-
(
|
|
514
|
+
(_c = message == null ? void 0 : message.info) == null ? void 0 : _c.call(message, t("This model has no configurable flow settings"));
|
|
513
515
|
}
|
|
514
516
|
return false;
|
|
515
517
|
}
|
|
@@ -521,7 +523,7 @@ const _FlowSettings = class _FlowSettings {
|
|
|
521
523
|
const scopes = {
|
|
522
524
|
// 为 schema 表达式提供上下文能力(可在表达式中使用 useFlowSettingsContext 等)
|
|
523
525
|
useFlowSettingsContext: import_useFlowSettingsContext.useFlowSettingsContext,
|
|
524
|
-
...((
|
|
526
|
+
...((_d = flowEngine == null ? void 0 : flowEngine.flowSettings) == null ? void 0 : _d.scopes) || {}
|
|
525
527
|
};
|
|
526
528
|
let modeProps = typeof resolvedUiMode === "object" && resolvedUiMode ? resolvedUiMode.props || {} : {};
|
|
527
529
|
if (modeType === "embed") {
|
|
@@ -535,7 +537,7 @@ const _FlowSettings = class _FlowSettings {
|
|
|
535
537
|
target,
|
|
536
538
|
styles: {
|
|
537
539
|
body: {
|
|
538
|
-
padding: (
|
|
540
|
+
padding: (_e = flowEngine.context.themeToken) == null ? void 0 : _e.padding
|
|
539
541
|
}
|
|
540
542
|
},
|
|
541
543
|
...modeProps,
|
|
@@ -602,6 +604,8 @@ const _FlowSettings = class _FlowSettings {
|
|
|
602
604
|
zIndex: 5e3,
|
|
603
605
|
// 允许透传其它 props(如 maskClosable、footer 等),但确保 content 由我们接管
|
|
604
606
|
...modeProps,
|
|
607
|
+
// 统一构造 settings 弹窗的 inputArgs(集合/记录/父导航/关联)
|
|
608
|
+
inputArgs: (0, import_utils.buildSettingsViewInputArgs)(model, modeProps == null ? void 0 : modeProps.inputArgs),
|
|
605
609
|
content: /* @__PURE__ */ __name((currentView, viewCtx) => {
|
|
606
610
|
viewCtx == null ? void 0 : viewCtx.defineMethod("getStepFormValues", (flowKey2, stepKey2) => {
|
|
607
611
|
var _a2;
|
|
@@ -44,7 +44,8 @@ function useApplyAutoFlows(modelOrUid, inputArgs, options) {
|
|
|
44
44
|
model == null ? void 0 : model.useHooksBeforeRender();
|
|
45
45
|
const { loading, error } = (0, import_ahooks.useRequest)(
|
|
46
46
|
async () => {
|
|
47
|
-
|
|
47
|
+
if (!model) return;
|
|
48
|
+
await model.dispatchEvent("beforeRender", inputArgs);
|
|
48
49
|
},
|
|
49
50
|
{
|
|
50
51
|
refreshDeps: [model, inputArgs]
|
package/lib/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
export * from './types';
|
|
10
10
|
export * from './utils';
|
|
11
|
+
export { compileRunJs } from './utils/jsxTransform';
|
|
11
12
|
export * from './resources';
|
|
12
13
|
export * from './flowEngine';
|
|
13
14
|
export * from './hooks';
|
|
@@ -22,6 +23,11 @@ export * from './ElementProxy';
|
|
|
22
23
|
export * from './flowContext';
|
|
23
24
|
export * from './FlowContextProvider';
|
|
24
25
|
export * from './JSRunner';
|
|
25
|
-
export
|
|
26
|
+
export { getRunJSDocFor, createJSRunnerWithVersion, getRunJSScenesForModel, getRunJSScenesForContext, } from './runjs-context/helpers';
|
|
27
|
+
export { RunJSContextRegistry, getModelClassName } from './runjs-context/registry';
|
|
28
|
+
export { setupRunJSContexts } from './runjs-context/setup';
|
|
29
|
+
export { getSnippetBody, listSnippetsForContext } from './runjs-context/snippets';
|
|
26
30
|
export * from './views';
|
|
27
31
|
export * from './FlowDefinition';
|
|
32
|
+
export { createViewScopedEngine } from './ViewScopedFlowEngine';
|
|
33
|
+
export { createBlockScopedEngine } from './BlockScopedFlowEngine';
|
package/lib/index.js
CHANGED
|
@@ -27,11 +27,24 @@ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "defau
|
|
|
27
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
28
|
var src_exports = {};
|
|
29
29
|
__export(src_exports, {
|
|
30
|
-
|
|
30
|
+
RunJSContextRegistry: () => import_registry.RunJSContextRegistry,
|
|
31
|
+
compileRunJs: () => import_jsxTransform.compileRunJs,
|
|
32
|
+
createBlockScopedEngine: () => import_BlockScopedFlowEngine.createBlockScopedEngine,
|
|
33
|
+
createJSRunnerWithVersion: () => import_helpers.createJSRunnerWithVersion,
|
|
34
|
+
createViewScopedEngine: () => import_ViewScopedFlowEngine.createViewScopedEngine,
|
|
35
|
+
getModelClassName: () => import_registry.getModelClassName,
|
|
36
|
+
getRunJSDocFor: () => import_helpers.getRunJSDocFor,
|
|
37
|
+
getRunJSScenesForContext: () => import_helpers.getRunJSScenesForContext,
|
|
38
|
+
getRunJSScenesForModel: () => import_helpers.getRunJSScenesForModel,
|
|
39
|
+
getSnippetBody: () => import_snippets.getSnippetBody,
|
|
40
|
+
listSnippetsForContext: () => import_snippets.listSnippetsForContext,
|
|
41
|
+
observer: () => import_reactive_react.observer,
|
|
42
|
+
setupRunJSContexts: () => import_setup.setupRunJSContexts
|
|
31
43
|
});
|
|
32
44
|
module.exports = __toCommonJS(src_exports);
|
|
33
45
|
__reExport(src_exports, require("./types"), module.exports);
|
|
34
46
|
__reExport(src_exports, require("./utils"), module.exports);
|
|
47
|
+
var import_jsxTransform = require("./utils/jsxTransform");
|
|
35
48
|
__reExport(src_exports, require("./resources"), module.exports);
|
|
36
49
|
__reExport(src_exports, require("./flowEngine"), module.exports);
|
|
37
50
|
__reExport(src_exports, require("./hooks"), module.exports);
|
|
@@ -46,12 +59,29 @@ __reExport(src_exports, require("./ElementProxy"), module.exports);
|
|
|
46
59
|
__reExport(src_exports, require("./flowContext"), module.exports);
|
|
47
60
|
__reExport(src_exports, require("./FlowContextProvider"), module.exports);
|
|
48
61
|
__reExport(src_exports, require("./JSRunner"), module.exports);
|
|
49
|
-
|
|
62
|
+
var import_helpers = require("./runjs-context/helpers");
|
|
63
|
+
var import_registry = require("./runjs-context/registry");
|
|
64
|
+
var import_setup = require("./runjs-context/setup");
|
|
65
|
+
var import_snippets = require("./runjs-context/snippets");
|
|
50
66
|
__reExport(src_exports, require("./views"), module.exports);
|
|
51
67
|
__reExport(src_exports, require("./FlowDefinition"), module.exports);
|
|
68
|
+
var import_ViewScopedFlowEngine = require("./ViewScopedFlowEngine");
|
|
69
|
+
var import_BlockScopedFlowEngine = require("./BlockScopedFlowEngine");
|
|
52
70
|
// Annotate the CommonJS export names for ESM import in node:
|
|
53
71
|
0 && (module.exports = {
|
|
72
|
+
RunJSContextRegistry,
|
|
73
|
+
compileRunJs,
|
|
74
|
+
createBlockScopedEngine,
|
|
75
|
+
createJSRunnerWithVersion,
|
|
76
|
+
createViewScopedEngine,
|
|
77
|
+
getModelClassName,
|
|
78
|
+
getRunJSDocFor,
|
|
79
|
+
getRunJSScenesForContext,
|
|
80
|
+
getRunJSScenesForModel,
|
|
81
|
+
getSnippetBody,
|
|
82
|
+
listSnippetsForContext,
|
|
54
83
|
observer,
|
|
84
|
+
setupRunJSContexts,
|
|
55
85
|
...require("./types"),
|
|
56
86
|
...require("./utils"),
|
|
57
87
|
...require("./resources"),
|
|
@@ -67,7 +97,6 @@ __reExport(src_exports, require("./FlowDefinition"), module.exports);
|
|
|
67
97
|
...require("./flowContext"),
|
|
68
98
|
...require("./FlowContextProvider"),
|
|
69
99
|
...require("./JSRunner"),
|
|
70
|
-
...require("./runjs-context"),
|
|
71
100
|
...require("./views"),
|
|
72
101
|
...require("./FlowDefinition")
|
|
73
102
|
});
|
package/lib/locale/en-US.json
CHANGED
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"UID copied to clipboard": "UID copied to clipboard",
|
|
24
24
|
"Copy failed": "Copy failed",
|
|
25
25
|
"Copy failed, please copy [{{uid}}] manually.": "Copy failed, please copy [{{uid}}] manually.",
|
|
26
|
+
"Copy failed under HTTP. Clipboard API is unavailable on non-HTTPS pages. Please copy [{{uid}}] manually.": "Copy failed under HTTP. Clipboard API is unavailable on non-HTTPS pages. Please copy [{{uid}}] manually.",
|
|
26
27
|
"Confirm delete": "Confirm delete",
|
|
27
28
|
"Are you sure you want to delete this item? This action cannot be undone.": "Are you sure you want to delete this item? This action cannot be undone.",
|
|
28
29
|
"Delete operation failed": "Delete operation failed",
|
|
@@ -57,5 +58,6 @@
|
|
|
57
58
|
"Name": "Name",
|
|
58
59
|
"Model with ID {{uid}} not found": "Model with ID {{uid}} not found",
|
|
59
60
|
"Common actions": "Common actions",
|
|
60
|
-
"This variable is not available": "This variable is not available"
|
|
61
|
-
|
|
61
|
+
"This variable is not available": "This variable is not available",
|
|
62
|
+
"Copy popup UID": "Copy popup UID"
|
|
63
|
+
}
|
package/lib/locale/index.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ export declare const locales: {
|
|
|
32
32
|
"UID copied to clipboard": string;
|
|
33
33
|
"Copy failed": string;
|
|
34
34
|
"Copy failed, please copy [{{uid}}] manually.": string;
|
|
35
|
+
"Copy failed under HTTP. Clipboard API is unavailable on non-HTTPS pages. Please copy [{{uid}}] manually.": string;
|
|
35
36
|
"Confirm delete": string;
|
|
36
37
|
"Are you sure you want to delete this item? This action cannot be undone.": string;
|
|
37
38
|
"Delete operation failed": string;
|
|
@@ -67,6 +68,7 @@ export declare const locales: {
|
|
|
67
68
|
"Model with ID {{uid}} not found": string;
|
|
68
69
|
"Common actions": string;
|
|
69
70
|
"This variable is not available": string;
|
|
71
|
+
"Copy popup UID": string;
|
|
70
72
|
};
|
|
71
73
|
'zh-CN': {
|
|
72
74
|
"Invalid model provided": string;
|
|
@@ -93,6 +95,7 @@ export declare const locales: {
|
|
|
93
95
|
"UID copied to clipboard": string;
|
|
94
96
|
"Copy failed": string;
|
|
95
97
|
"Copy failed, please copy [{{uid}}] manually.": string;
|
|
98
|
+
"Copy failed under HTTP. Clipboard API is unavailable on non-HTTPS pages. Please copy [{{uid}}] manually.": string;
|
|
96
99
|
"Confirm delete": string;
|
|
97
100
|
"Are you sure you want to delete this item? This action cannot be undone.": string;
|
|
98
101
|
"Delete operation failed": string;
|
|
@@ -128,6 +131,7 @@ export declare const locales: {
|
|
|
128
131
|
"Model with ID {{uid}} not found": string;
|
|
129
132
|
"Common actions": string;
|
|
130
133
|
"This variable is not available": string;
|
|
134
|
+
"Copy popup UID": string;
|
|
131
135
|
};
|
|
132
136
|
};
|
|
133
137
|
/**
|
package/lib/locale/zh-CN.json
CHANGED
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"UID copied to clipboard": "UID 已复制到剪贴板",
|
|
24
24
|
"Copy failed": "复制失败",
|
|
25
25
|
"Copy failed, please copy [{{uid}}] manually.": "复制失败,请手动复制 [{{uid}}]。",
|
|
26
|
+
"Copy failed under HTTP. Clipboard API is unavailable on non-HTTPS pages. Please copy [{{uid}}] manually.": "HTTP 环境下复制失败。非 HTTPS 页面不支持剪贴板 API,请手动复制 [{{uid}}]。",
|
|
26
27
|
"Confirm delete": "确认删除",
|
|
27
28
|
"Are you sure you want to delete this item? This action cannot be undone.": "确定要删除此项吗?此操作不可撤销。",
|
|
28
29
|
"Delete operation failed": "删除操作失败",
|
|
@@ -57,5 +58,6 @@
|
|
|
57
58
|
"Name": "名称",
|
|
58
59
|
"Model with ID {{uid}} not found": "未找到 ID 为 {{uid}} 的模型",
|
|
59
60
|
"Common actions": "通用操作",
|
|
60
|
-
"This variable is not available": "此变量不可用"
|
|
61
|
-
|
|
61
|
+
"This variable is not available": "此变量不可用",
|
|
62
|
+
"Copy popup UID": "复制弹窗 UID"
|
|
63
|
+
}
|
|
@@ -12,6 +12,7 @@ import { FlowEngineContext } from '../flowContext';
|
|
|
12
12
|
import { DefaultStructure } from '../types';
|
|
13
13
|
import { FlowModel } from './flowModel';
|
|
14
14
|
export declare function FieldPlaceholder(): React.JSX.Element;
|
|
15
|
+
export declare function FieldDeletePlaceholder(): React.JSX.Element;
|
|
15
16
|
export interface FieldSettingsInitParams {
|
|
16
17
|
dataSourceKey: string;
|
|
17
18
|
collectionName: string;
|
|
@@ -26,6 +27,7 @@ export interface BindingOptions {
|
|
|
26
27
|
}
|
|
27
28
|
export declare class CollectionFieldModel<T extends DefaultStructure = DefaultStructure> extends FlowModel<T> {
|
|
28
29
|
private static _bindings;
|
|
30
|
+
fieldDeleted: boolean;
|
|
29
31
|
renderHiddenInConfig(): React.ReactNode | undefined;
|
|
30
32
|
get title(): any;
|
|
31
33
|
onInit(options: any): void;
|
|
@@ -38,6 +40,7 @@ export declare class CollectionFieldModel<T extends DefaultStructure = DefaultSt
|
|
|
38
40
|
static getDefaultBindingByField(ctx: FlowEngineContext, collectionField: CollectionField, options?: {
|
|
39
41
|
useStrict?: boolean;
|
|
40
42
|
fallbackToTargetTitleField?: boolean;
|
|
43
|
+
targetCollectionTitleField?: CollectionField;
|
|
41
44
|
}): BindingOptions | null;
|
|
42
45
|
static bindModelToInterface(modelName: string, interfaceName: string | string[], options?: {
|
|
43
46
|
isDefault?: boolean;
|
|
@@ -40,11 +40,14 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
40
40
|
var CollectionFieldModel_exports = {};
|
|
41
41
|
__export(CollectionFieldModel_exports, {
|
|
42
42
|
CollectionFieldModel: () => CollectionFieldModel,
|
|
43
|
+
FieldDeletePlaceholder: () => FieldDeletePlaceholder,
|
|
43
44
|
FieldPlaceholder: () => FieldPlaceholder
|
|
44
45
|
});
|
|
45
46
|
module.exports = __toCommonJS(CollectionFieldModel_exports);
|
|
46
47
|
var import_antd = require("antd");
|
|
47
48
|
var import_react = __toESM(require("react"));
|
|
49
|
+
var import_react_i18next = require("react-i18next");
|
|
50
|
+
var import_hooks = require("../hooks");
|
|
48
51
|
var import_utils = require("../utils");
|
|
49
52
|
var import_flowModel = require("./flowModel");
|
|
50
53
|
function FieldPlaceholder() {
|
|
@@ -62,9 +65,40 @@ function FieldPlaceholder() {
|
|
|
62
65
|
));
|
|
63
66
|
}
|
|
64
67
|
__name(FieldPlaceholder, "FieldPlaceholder");
|
|
68
|
+
function FieldDeletePlaceholder() {
|
|
69
|
+
const { t } = (0, import_react_i18next.useTranslation)();
|
|
70
|
+
const model = (0, import_hooks.useFlowModel)();
|
|
71
|
+
const blockModel = model.context.blockModel;
|
|
72
|
+
const dataSource = blockModel.collection.dataSource;
|
|
73
|
+
const collection = blockModel.collection;
|
|
74
|
+
const name = model.fieldPath;
|
|
75
|
+
const nameValue = (0, import_react.useMemo)(() => {
|
|
76
|
+
const dataSourcePrefix = `${t(dataSource.displayName || dataSource.key)} > `;
|
|
77
|
+
const collectionPrefix = collection ? `${t(collection.title) || collection.name || collection.tableName} > ` : "";
|
|
78
|
+
return `${dataSourcePrefix}${collectionPrefix}${name}`;
|
|
79
|
+
}, []);
|
|
80
|
+
return /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, null, /* @__PURE__ */ import_react.default.createElement(
|
|
81
|
+
"div",
|
|
82
|
+
{
|
|
83
|
+
style: {
|
|
84
|
+
color: "rgba(0,0,0,0.45)"
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
t(`The {{type}} "{{name}}" may have been deleted. Please remove this {{blockType}}.`, {
|
|
88
|
+
type: t("Field"),
|
|
89
|
+
name: nameValue,
|
|
90
|
+
blockType: t("Field")
|
|
91
|
+
}).replaceAll(">", ">")
|
|
92
|
+
));
|
|
93
|
+
}
|
|
94
|
+
__name(FieldDeletePlaceholder, "FieldDeletePlaceholder");
|
|
65
95
|
const defaultWhen = /* @__PURE__ */ __name(() => true, "defaultWhen");
|
|
66
96
|
const _CollectionFieldModel = class _CollectionFieldModel extends import_flowModel.FlowModel {
|
|
97
|
+
fieldDeleted = false;
|
|
67
98
|
renderHiddenInConfig() {
|
|
99
|
+
if (this.fieldDeleted) {
|
|
100
|
+
return /* @__PURE__ */ import_react.default.createElement(FieldDeletePlaceholder, null);
|
|
101
|
+
}
|
|
68
102
|
return /* @__PURE__ */ import_react.default.createElement(FieldPlaceholder, null);
|
|
69
103
|
}
|
|
70
104
|
get title() {
|
|
@@ -86,11 +120,13 @@ const _CollectionFieldModel = class _CollectionFieldModel extends import_flowMod
|
|
|
86
120
|
return this.fieldPath;
|
|
87
121
|
}, "get")
|
|
88
122
|
});
|
|
89
|
-
this.context.blockModel
|
|
90
|
-
|
|
123
|
+
if (this.context.blockModel) {
|
|
124
|
+
this.context.blockModel.addAppends(this.fieldPath);
|
|
125
|
+
this.context.blockModel.addAppends(this.associationPathName);
|
|
126
|
+
}
|
|
91
127
|
}
|
|
92
128
|
getFieldSettingsInitParams() {
|
|
93
|
-
return this.getStepParams("fieldSettings", "init");
|
|
129
|
+
return this.getStepParams("fieldSettings", "init") || {};
|
|
94
130
|
}
|
|
95
131
|
get fieldPath() {
|
|
96
132
|
return this.getFieldSettingsInitParams().fieldPath;
|
|
@@ -107,6 +143,9 @@ const _CollectionFieldModel = class _CollectionFieldModel extends import_flowMod
|
|
|
107
143
|
}
|
|
108
144
|
}
|
|
109
145
|
static getBindingsByField(ctx, collectionField) {
|
|
146
|
+
if (!collectionField) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
110
149
|
const interfaceName = collectionField.interface;
|
|
111
150
|
if (!this.bindings.has(interfaceName)) {
|
|
112
151
|
return [];
|
|
@@ -120,8 +159,11 @@ const _CollectionFieldModel = class _CollectionFieldModel extends import_flowMod
|
|
|
120
159
|
if (options.fallbackToTargetTitleField) {
|
|
121
160
|
const binding = this.getDefaultBindingByField(ctx, collectionField, { useStrict: true });
|
|
122
161
|
if (!binding) {
|
|
123
|
-
if (collectionField.isAssociationField() && collectionField.targetCollectionTitleField) {
|
|
124
|
-
return this.getDefaultBindingByField(
|
|
162
|
+
if (collectionField.isAssociationField() && (options == null ? void 0 : options.targetCollectionTitleField) || collectionField.targetCollectionTitleField) {
|
|
163
|
+
return this.getDefaultBindingByField(
|
|
164
|
+
ctx,
|
|
165
|
+
(options == null ? void 0 : options.targetCollectionTitleField) || collectionField.targetCollectionTitleField
|
|
166
|
+
);
|
|
125
167
|
}
|
|
126
168
|
}
|
|
127
169
|
return binding;
|
|
@@ -238,5 +280,6 @@ CollectionFieldModel.registerFlow({
|
|
|
238
280
|
// Annotate the CommonJS export names for ESM import in node:
|
|
239
281
|
0 && (module.exports = {
|
|
240
282
|
CollectionFieldModel,
|
|
283
|
+
FieldDeletePlaceholder,
|
|
241
284
|
FieldPlaceholder
|
|
242
285
|
});
|
|
@@ -18,8 +18,9 @@ import { ModelEventRegistry } from '../event-registry/ModelEventRegistry';
|
|
|
18
18
|
import { GlobalFlowRegistry } from '../flow-registry/GlobalFlowRegistry';
|
|
19
19
|
import { FlowDefinition } from '../FlowDefinition';
|
|
20
20
|
import { FlowSettingsOpenOptions } from '../flowSettings';
|
|
21
|
-
import type { EventDefinition } from '../types';
|
|
21
|
+
import type { EventDefinition, DispatchEventOptions } from '../types';
|
|
22
22
|
import { ForkFlowModel } from './forkFlowModel';
|
|
23
|
+
import type { ScheduleOptions } from '../scheduler/ModelOperationScheduler';
|
|
23
24
|
export declare enum ModelRenderMode {
|
|
24
25
|
ReactElement = "reactElement",
|
|
25
26
|
RenderFunction = "renderFunction"
|
|
@@ -42,6 +43,7 @@ export declare class FlowModel<Structure extends DefaultStructure = DefaultStruc
|
|
|
42
43
|
private _options;
|
|
43
44
|
protected _title: string;
|
|
44
45
|
isNew: boolean;
|
|
46
|
+
skeleton: any;
|
|
45
47
|
/**
|
|
46
48
|
* 所有 fork 实例的引用集合。
|
|
47
49
|
* 使用 Set 便于在销毁时主动遍历并调用 dispose,避免悬挂引用。
|
|
@@ -53,7 +55,7 @@ export declare class FlowModel<Structure extends DefaultStructure = DefaultStruc
|
|
|
53
55
|
*/
|
|
54
56
|
private forkCache;
|
|
55
57
|
/**
|
|
56
|
-
* 上一次
|
|
58
|
+
* 上一次 beforeRender 的执行参数
|
|
57
59
|
*/
|
|
58
60
|
private _lastAutoRunParams;
|
|
59
61
|
protected observerDispose: () => void;
|
|
@@ -90,6 +92,7 @@ export declare class FlowModel<Structure extends DefaultStructure = DefaultStruc
|
|
|
90
92
|
get subType(): "object" | "array";
|
|
91
93
|
get reactView(): import("../ReactView").ReactView;
|
|
92
94
|
get parentId(): string;
|
|
95
|
+
scheduleModelOperation(toUid: string, fn: (model: FlowModel) => Promise<void> | void, options?: ScheduleOptions): import("../scheduler/ModelOperationScheduler").ScheduledCancel;
|
|
93
96
|
static get meta(): FlowModelMeta;
|
|
94
97
|
static get globalFlowRegistry(): GlobalFlowRegistry;
|
|
95
98
|
protected static get actionRegistry(): ModelActionRegistry;
|
|
@@ -117,7 +120,11 @@ export declare class FlowModel<Structure extends DefaultStructure = DefaultStruc
|
|
|
117
120
|
setTitle(value: string): void;
|
|
118
121
|
setHidden(value: boolean): void;
|
|
119
122
|
_createSubModels(subModels: Record<string, CreateSubModelOptions | CreateSubModelOptions[]>): void;
|
|
120
|
-
|
|
123
|
+
/**
|
|
124
|
+
* 失效指定事件的流程缓存;未指定 eventName 时,失效当前模型全部事件缓存。
|
|
125
|
+
* - 默认 beforeRender 与其它事件共享同一缓存体系:prefix=`event:${scope}`,flowKey=`eventName`,uid=`model.uid`
|
|
126
|
+
*/
|
|
127
|
+
invalidateFlowCache(eventName?: string, deep?: boolean): void;
|
|
121
128
|
/**
|
|
122
129
|
* 设置FlowEngine实例
|
|
123
130
|
* @param {FlowEngine} flowEngine FlowEngine实例
|
|
@@ -187,45 +194,36 @@ export declare class FlowModel<Structure extends DefaultStructure = DefaultStruc
|
|
|
187
194
|
private _dispatchEvent;
|
|
188
195
|
private _dispatchEventWithDebounce;
|
|
189
196
|
dispatchEvent(eventName: string, inputArgs?: Record<string, any>, options?: {
|
|
190
|
-
/**
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
debounce: boolean;
|
|
194
|
-
}): Promise<void>;
|
|
197
|
+
/** 是否要开启防抖功能 */
|
|
198
|
+
debounce?: boolean;
|
|
199
|
+
} & DispatchEventOptions): Promise<any[]>;
|
|
195
200
|
/**
|
|
196
|
-
*
|
|
197
|
-
*
|
|
201
|
+
* 按事件名获取对应的流程集合(保持 getFlows 的顺序,即按 sort 排序)。
|
|
202
|
+
* - beforeRender 兼容:除显式 on: 'beforeRender' 外,包含未声明 on 且 manual !== true 的流程。
|
|
198
203
|
*/
|
|
199
|
-
|
|
204
|
+
getEventFlows(eventName: string): FlowDefinition[];
|
|
200
205
|
/**
|
|
201
|
-
* 重新执行上一次的
|
|
206
|
+
* 重新执行上一次的 beforeRender,保持参数一致
|
|
202
207
|
* 如果之前没有执行过,则直接跳过
|
|
203
208
|
* 使用 lodash debounce 避免频繁调用
|
|
204
209
|
*/
|
|
205
210
|
private _rerunLastAutoRun;
|
|
206
211
|
/**
|
|
207
|
-
*
|
|
208
|
-
*
|
|
212
|
+
* 通用事件分发钩子:开始
|
|
213
|
+
* 子类可覆盖;beforeRender 事件可通过抛出 FlowExitException 提前终止。
|
|
209
214
|
*/
|
|
210
|
-
|
|
215
|
+
onDispatchEventStart(eventName: string, options?: DispatchEventOptions, inputArgs?: Record<string, any>): Promise<void>;
|
|
211
216
|
/**
|
|
212
|
-
*
|
|
217
|
+
* 通用事件分发钩子:结束
|
|
213
218
|
* 子类可覆盖。
|
|
214
219
|
*/
|
|
215
|
-
|
|
220
|
+
onDispatchEventEnd(eventName: string, options?: DispatchEventOptions, inputArgs?: Record<string, any>, results?: any[]): Promise<void>;
|
|
216
221
|
/**
|
|
217
|
-
*
|
|
222
|
+
* 通用事件分发钩子:错误
|
|
218
223
|
* 子类可覆盖。
|
|
219
224
|
*/
|
|
220
|
-
|
|
225
|
+
onDispatchEventError(eventName: string, options?: DispatchEventOptions, inputArgs?: Record<string, any>, error?: Error): Promise<void>;
|
|
221
226
|
useHooksBeforeRender(): void;
|
|
222
|
-
/**
|
|
223
|
-
* 执行所有自动应用流程
|
|
224
|
-
* @param {Record<string, any>} [inputArgs] 可选的运行时参数
|
|
225
|
-
* @param {boolean} [useCache=true] 是否使用缓存机制,默认为 true
|
|
226
|
-
* @returns {Promise<any[]>} 所有自动应用流程的执行结果数组
|
|
227
|
-
*/
|
|
228
|
-
applyAutoFlows(inputArgs?: Record<string, any>, useCache?: boolean): Promise<any[]>;
|
|
229
227
|
/**
|
|
230
228
|
* 智能检测是否应该跳过响应式包装
|
|
231
229
|
* 说明:
|
|
@@ -261,9 +259,9 @@ export declare class FlowModel<Structure extends DefaultStructure = DefaultStruc
|
|
|
261
259
|
render(): any;
|
|
262
260
|
rerender(): Promise<void>;
|
|
263
261
|
/**
|
|
264
|
-
*
|
|
262
|
+
* 事件缓存的作用域标识;可按事件区分(默认与事件无关的 scope 返回 'default')。
|
|
265
263
|
*/
|
|
266
|
-
|
|
264
|
+
getFlowCacheScope(eventName: string): string;
|
|
267
265
|
setParent(parent: FlowModel): void;
|
|
268
266
|
removeParentDelegate(): void;
|
|
269
267
|
addSubModel<T extends FlowModel>(subKey: string, options: CreateModelOptions | T): T;
|
|
@@ -273,7 +271,10 @@ export declare class FlowModel<Structure extends DefaultStructure = DefaultStruc
|
|
|
273
271
|
hasSubModel<K extends keyof Structure['subModels']>(subKey: K): boolean;
|
|
274
272
|
findSubModel<K extends keyof Structure['subModels'], R>(subKey: K, callback: (model: ArrayElementType<Structure['subModels'][K]>) => R): ArrayElementType<Structure['subModels'][K]> | null;
|
|
275
273
|
createRootModel(options: any): FlowModel<DefaultStructure>;
|
|
276
|
-
|
|
274
|
+
/**
|
|
275
|
+
* 对指定子模型派发 beforeRender 事件(顺序执行并使用缓存)。
|
|
276
|
+
*/
|
|
277
|
+
applySubModelsBeforeRenderFlows<K extends keyof Structure['subModels']>(subKey: K, inputArgs?: Record<string, any>, shared?: Record<string, any>): Promise<void>;
|
|
277
278
|
/**
|
|
278
279
|
* 创建一个 fork 实例,实现"一份数据(master)多视图(fork)"的能力。
|
|
279
280
|
* @param {IModelComponentProps} [localProps={}] fork 专属的局部 props,优先级高于 master.props
|