@nocobase/plugin-workflow 2.2.0-alpha.1 → 2.2.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client-v2.d.ts +2 -0
- package/client-v2.js +1 -0
- package/dist/client/119.e7dbd037d52d1286.js +10 -0
- package/dist/client/142.d84a976875799df4.js +10 -0
- package/dist/client/159.3d5abee06b818db3.js +10 -0
- package/dist/client/276.69fb2aea13bc7c37.js +10 -0
- package/dist/client/346.66d060d37843d3d1.js +10 -0
- package/dist/client/382.80ebd002a9971b65.js +10 -0
- package/dist/client/394.d7eacf666590a6ae.js +10 -0
- package/dist/client/438.c4de8f085e490158.js +10 -0
- package/dist/client/509.2f72dd97808f12d1.js +10 -0
- package/dist/client/54.c452a382e9b3953d.js +10 -0
- package/dist/client/618.a97bc812678ab2a7.js +10 -0
- package/dist/client/635.3f165e9ed7e940b2.js +10 -0
- package/dist/client/67.4117e04bd42f9d42.js +10 -0
- package/dist/client/719.5801e3f1cf81b97b.js +10 -0
- package/dist/client/739.955f18b3dc31ae3a.js +10 -0
- package/dist/client/759.13aab01e6912ed8d.js +10 -0
- package/dist/client/772.1ebaef11a0ac8688.js +10 -0
- package/dist/client/782.332fd345a98b82c2.js +10 -0
- package/dist/client/828.77de843c49fb307a.js +10 -0
- package/dist/client/87.d2c2b5b1cae08bfc.js +10 -0
- package/dist/client/938.77649c32dae1c225.js +10 -0
- package/dist/client/964.cb1ecff7a46687b7.js +10 -0
- package/dist/client/972.4da2796f3f2df874.js +10 -0
- package/dist/client/AddNodeContext.d.ts +1 -9
- package/dist/client/Branch.d.ts +1 -1
- package/dist/client/BranchContext.d.ts +2 -10
- package/dist/client/FlowContext.d.ts +10 -5
- package/dist/client/NodeClipboardContext.d.ts +12 -2
- package/dist/client/NodeDragContext.d.ts +14 -2
- package/dist/client/RemoveNodeContext.d.ts +16 -2
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/nodeVariableUtils.d.ts +7 -6
- package/dist/client/nodes/calculation.d.ts +3 -75
- package/dist/client/nodes/condition.d.ts +7 -111
- package/dist/client/nodes/create.d.ts +3 -124
- package/dist/client/nodes/destroy.d.ts +2 -57
- package/dist/client/nodes/end.d.ts +2 -23
- package/dist/client/nodes/index.d.ts +2 -91
- package/dist/client/nodes/multi-conditions.d.ts +10 -48
- package/dist/client/nodes/output.d.ts +2 -44
- package/dist/client/nodes/query.d.ts +3 -255
- package/dist/client/nodes/update.d.ts +2 -117
- package/dist/client/style.d.ts +7 -26
- package/dist/client/triggers/collection.d.ts +3 -154
- package/dist/client/triggers/index.d.ts +2 -36
- package/dist/client/triggers/schedule/index.d.ts +8 -65
- package/dist/client/utils.d.ts +4 -5
- package/dist/client/variable.d.ts +4 -44
- package/dist/client-v2/119.81195bcd0d451279.js +10 -0
- package/dist/client-v2/142.3d386748090ff6d3.js +10 -0
- package/dist/client-v2/159.cb221540c286cd32.js +10 -0
- package/dist/client-v2/224.44a5e1227bee33fb.js +10 -0
- package/dist/client-v2/276.43297f402f31970e.js +10 -0
- package/dist/client-v2/326.bdc99ad8e7590970.js +10 -0
- package/dist/client-v2/346.8c038b3c99d4fdc9.js +10 -0
- package/dist/client-v2/382.05f5482bb512b179.js +10 -0
- package/dist/client-v2/387.ab3eac2eb447f36f.js +10 -0
- package/dist/client-v2/394.515ed058e7f72797.js +10 -0
- package/dist/client-v2/438.b7df0416b66f8f64.js +10 -0
- package/dist/client-v2/513.ab2bdd96ad9ece4d.js +10 -0
- package/dist/client-v2/54.287764bc467d65da.js +10 -0
- package/dist/client-v2/635.37de4abe241b30e8.js +10 -0
- package/dist/client-v2/719.05cf070ef89a78f4.js +10 -0
- package/dist/client-v2/739.906e94bbe6d52a3d.js +10 -0
- package/dist/client-v2/759.7b162ad3adf450f1.js +10 -0
- package/dist/client-v2/772.8e5148d8c1518449.js +10 -0
- package/dist/client-v2/938.717e47af39485b29.js +10 -0
- package/dist/client-v2/ExecutionCanvas.d.ts +15 -0
- package/dist/client-v2/canvas/AddNodeContext.d.ts +35 -0
- package/dist/client-v2/canvas/AddNodeContext.shared.d.ts +33 -0
- package/dist/client-v2/canvas/AddNodeSlot.d.ts +20 -0
- package/dist/client-v2/canvas/Branch.d.ts +32 -0
- package/dist/client-v2/canvas/BranchContext.d.ts +20 -0
- package/dist/client-v2/canvas/BranchRenderContext.d.ts +14 -0
- package/dist/client-v2/canvas/CanvasContent.d.ts +20 -0
- package/dist/client-v2/canvas/DownstreamBranchIndex.d.ts +20 -0
- package/dist/client-v2/canvas/Instruction.d.ts +139 -0
- package/dist/{client/triggers/schedule/EndsByField.d.ts → client-v2/canvas/JobButton.d.ts} +3 -3
- package/dist/client-v2/canvas/Node.d.ts +36 -0
- package/dist/client-v2/canvas/NodeClipboardContext.d.ts +64 -0
- package/dist/client-v2/canvas/NodeConfigDrawer.d.ts +27 -0
- package/dist/client-v2/canvas/NodeDragContext.d.ts +83 -0
- package/dist/client-v2/canvas/RemoveNodeContext.d.ts +45 -0
- package/dist/client-v2/canvas/WorkflowTypedVariableInput.d.ts +16 -0
- package/dist/client-v2/canvas/WorkflowVariableInput.d.ts +39 -0
- package/dist/client-v2/canvas/WorkflowVariableJsonTextArea.d.ts +15 -0
- package/dist/client-v2/canvas/WorkflowVariableTextArea.d.ts +18 -0
- package/dist/client-v2/canvas/adaptVariableOptionToMetaTree.d.ts +48 -0
- package/dist/client-v2/canvas/addNodeController.d.ts +70 -0
- package/dist/client-v2/canvas/collectionFieldOptions.d.ts +57 -0
- package/dist/client-v2/canvas/contexts.d.ts +84 -0
- package/dist/client-v2/canvas/dropImpact.d.ts +28 -0
- package/dist/client-v2/canvas/instructionAvailability.d.ts +26 -0
- package/dist/client-v2/canvas/nodeRenderDispatch.d.ts +79 -0
- package/dist/client-v2/canvas/nodeTree.d.ts +21 -0
- package/dist/client-v2/canvas/nodeVariableUtils.d.ts +14 -0
- package/dist/client-v2/canvas/removeNodeUtils.d.ts +31 -0
- package/dist/client-v2/canvas/style.d.ts +35 -0
- package/dist/client-v2/canvas/textAreaInsertion.d.ts +14 -0
- package/dist/client-v2/canvas/useWorkflowInstruction.d.ts +23 -0
- package/dist/client-v2/canvas/useWorkflowVariableOptions.d.ts +40 -0
- package/dist/client-v2/canvas/workflowVariableConverters.d.ts +13 -0
- package/dist/client-v2/components/Calculation.d.ts +18 -0
- package/dist/client-v2/components/ExecutionStatusIcon.d.ts +18 -0
- package/dist/{client/triggers/schedule/RepeatField.d.ts → client-v2/components/ExecutionStatusTag.d.ts} +3 -4
- package/dist/client-v2/components/ExecutionViewHeader.d.ts +29 -0
- package/dist/client-v2/components/ExecutionsDropdown.d.ts +25 -0
- package/dist/client-v2/components/FilterDynamicComponent.d.ts +22 -0
- package/dist/client-v2/components/HideVariableContext.d.ts +11 -0
- package/dist/client-v2/components/JobResultModal.d.ts +11 -0
- package/dist/client-v2/components/RadioWithTooltip.d.ts +23 -0
- package/dist/client-v2/components/SyncModeSelect.d.ts +16 -0
- package/dist/{client/triggers/schedule/OnField.d.ts → client-v2/components/SyncModeTag.d.ts} +3 -3
- package/dist/client-v2/components/TestRunButton.d.ts +36 -0
- package/dist/client-v2/components/TimeoutInput.d.ts +15 -0
- package/dist/client-v2/components/WorkflowCanvasHeader.d.ts +17 -0
- package/dist/client-v2/components/WorkflowDetailsModal.d.ts +25 -0
- package/dist/client-v2/components/WorkflowEnabledSwitch.d.ts +16 -0
- package/dist/client-v2/components/WorkflowMenu.d.ts +17 -0
- package/dist/client-v2/components/WorkflowRevisionsDropdown.d.ts +15 -0
- package/dist/client-v2/components/WorkflowVariableWrapper.d.ts +25 -0
- package/dist/client-v2/components/collection/AppendsSelect.d.ts +15 -0
- package/dist/client-v2/components/collection/AssignedFieldsEditor.d.ts +16 -0
- package/dist/client-v2/components/collection/CollectionCascader.d.ts +15 -0
- package/dist/client-v2/components/collection/FieldsSelect.d.ts +16 -0
- package/dist/client-v2/components/collection/PaginationFields.d.ts +14 -0
- package/dist/client-v2/components/collection/SortFieldsInput.d.ts +19 -0
- package/dist/client-v2/components/collection/TriggerCollectionRecordSelect.d.ts +15 -0
- package/dist/client-v2/components/collection/index.d.ts +16 -0
- package/dist/client-v2/components/collection/utils.d.ts +42 -0
- package/dist/client-v2/components/formatResultForDisplay.d.ts +17 -0
- package/dist/client-v2/components/jobStatus.d.ts +27 -0
- package/dist/client-v2/components/renderEngineReference.d.ts +10 -0
- package/dist/client-v2/components/workflowCanvas.d.ts +41 -0
- package/dist/client-v2/constants.d.ts +14 -0
- package/dist/client-v2/hooks/useWorkflowRuntimePaths.d.ts +37 -0
- package/dist/client-v2/index.d.ts +43 -0
- package/dist/client-v2/index.js +10 -0
- package/dist/client-v2/locale.d.ts +41 -0
- package/dist/{client → client-v2}/models/NodeDetailsGridModel.d.ts +1 -1
- package/dist/{client → client-v2}/models/NodeDetailsModel.d.ts +1 -1
- package/dist/{client → client-v2}/models/NodeValueModel.d.ts +1 -1
- package/dist/{client → client-v2}/models/TaskCardCommonItemModel.d.ts +1 -1
- package/dist/{client → client-v2}/models/index.d.ts +1 -0
- package/dist/client-v2/models/triggerWorkflows.d.ts +43 -0
- package/dist/client-v2/nodes/calculation.d.ts +38 -0
- package/dist/client-v2/nodes/collectionNode.d.ts +29 -0
- package/dist/client-v2/nodes/components/calculation.d.ts +11 -0
- package/dist/client-v2/nodes/components/collection.d.ts +15 -0
- package/dist/client-v2/nodes/components/condition.d.ts +25 -0
- package/dist/client-v2/nodes/components/conditionShared.d.ts +20 -0
- package/dist/client-v2/nodes/components/create.d.ts +12 -0
- package/dist/client-v2/nodes/components/destroy.d.ts +12 -0
- package/dist/{client/triggers/schedule/ScheduleConfig.d.ts → client-v2/nodes/components/end.d.ts} +1 -1
- package/dist/client-v2/nodes/components/filter.d.ts +16 -0
- package/dist/client-v2/nodes/components/multi-conditions.d.ts +13 -0
- package/dist/client-v2/nodes/components/multiConditionsShared.d.ts +20 -0
- package/dist/client-v2/nodes/components/output.d.ts +10 -0
- package/dist/client-v2/nodes/components/query.d.ts +12 -0
- package/dist/client-v2/nodes/components/update.d.ts +12 -0
- package/dist/client-v2/nodes/condition.d.ts +46 -0
- package/dist/client-v2/nodes/create.d.ts +30 -0
- package/dist/client-v2/nodes/destroy.d.ts +24 -0
- package/dist/client-v2/nodes/end.d.ts +21 -0
- package/dist/client-v2/nodes/multi-conditions.d.ts +34 -0
- package/dist/client-v2/nodes/output.d.ts +29 -0
- package/dist/client-v2/nodes/query.d.ts +32 -0
- package/dist/client-v2/nodes/update.d.ts +25 -0
- package/dist/client-v2/pages/ExecutionHistoryDrawer.d.ts +13 -0
- package/dist/client-v2/pages/ExecutionViewPage.d.ts +10 -0
- package/dist/client-v2/pages/WorkflowCanvasPage.d.ts +10 -0
- package/dist/client-v2/pages/WorkflowCategoryTabs.d.ts +25 -0
- package/dist/client-v2/pages/WorkflowFormDrawer.d.ts +39 -0
- package/dist/client-v2/pages/WorkflowPane.d.ts +10 -0
- package/dist/client-v2/plugin.d.ts +67 -0
- package/dist/client-v2/triggers/ExecuteWorkflowButton.d.ts +35 -0
- package/dist/client-v2/triggers/TriggerConfig.d.ts +22 -0
- package/dist/client-v2/triggers/TriggerExecutionButton.d.ts +13 -0
- package/dist/client-v2/triggers/collection/CollectionConfig.d.ts +14 -0
- package/dist/client-v2/triggers/collection/TriggerCollectionConfig.d.ts +11 -0
- package/dist/client-v2/triggers/collection/constants.d.ts +28 -0
- package/dist/client-v2/triggers/collection/index.d.ts +40 -0
- package/dist/client-v2/triggers/index.d.ts +61 -0
- package/dist/client-v2/triggers/schedule/EndsByField.d.ts +17 -0
- package/dist/client-v2/triggers/schedule/OnField.d.ts +20 -0
- package/dist/client-v2/triggers/schedule/RepeatField.d.ts +23 -0
- package/dist/client-v2/triggers/schedule/ScheduleConfig.d.ts +17 -0
- package/dist/client-v2/triggers/schedule/ScheduleModes.d.ts +41 -0
- package/dist/{client → client-v2}/triggers/schedule/TriggerScheduleConfig.d.ts +1 -0
- package/dist/{client → client-v2}/triggers/schedule/constants.d.ts +8 -5
- package/dist/client-v2/triggers/schedule/index.d.ts +40 -0
- package/dist/client-v2/triggers/schedule/locale/Cron.zh-CN.d.ts +11 -0
- package/dist/common/executionStatus.d.ts +44 -0
- package/dist/common/executionStatus.js +133 -0
- package/dist/externalVersion.js +16 -12
- package/dist/locale/de-DE.json +14 -1
- package/dist/locale/en-US.json +22 -2
- package/dist/locale/es-ES.json +14 -1
- package/dist/locale/fr-FR.json +14 -1
- package/dist/locale/hu-HU.json +14 -1
- package/dist/locale/id-ID.json +14 -1
- package/dist/locale/it-IT.json +14 -1
- package/dist/locale/ja-JP.json +14 -1
- package/dist/locale/ko-KR.json +14 -1
- package/dist/locale/nl-NL.json +14 -1
- package/dist/locale/pt-BR.json +14 -1
- package/dist/locale/ru-RU.json +14 -1
- package/dist/locale/tr-TR.json +14 -1
- package/dist/locale/uk-UA.json +14 -1
- package/dist/locale/vi-VN.json +14 -1
- package/dist/locale/zh-CN.json +21 -2
- package/dist/locale/zh-TW.json +14 -1
- package/dist/node_modules/cron-parser/package.json +1 -1
- package/dist/node_modules/joi/package.json +1 -1
- package/dist/node_modules/lru-cache/package.json +1 -1
- package/dist/node_modules/nodejs-snowflake/package.json +1 -1
- package/dist/server/Dispatcher.d.ts +1 -0
- package/dist/server/Dispatcher.js +46 -28
- package/dist/server/ExecutionTimeoutManager.js +2 -2
- package/dist/server/Processor.d.ts +16 -0
- package/dist/server/Processor.js +112 -0
- package/dist/server/actions/nodes.js +36 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/server/instructions/CreateInstruction.js +6 -2
- package/dist/server/instructions/DestroyInstruction.js +2 -1
- package/dist/server/instructions/QueryInstruction.js +2 -1
- package/dist/server/instructions/UpdateInstruction.js +2 -1
- package/dist/server/triggers/CollectionTrigger.d.ts +5 -0
- package/dist/server/triggers/CollectionTrigger.js +26 -1
- package/dist/server/utils.js +27 -27
- package/package.json +3 -2
- package/dist/client/618.19af7f84261c815d.js +0 -10
- package/dist/client/67.452743ce8ec30617.js +0 -10
- package/dist/client/964.ffbf5b47ed12bbdc.js +0 -10
- package/dist/client/triggers/schedule/ScheduleModes.d.ts +0 -170
- package/dist/client/triggers/schedule/locale/Cron.zh-CN.d.ts +0 -42
|
@@ -0,0 +1,139 @@
|
|
|
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
|
+
* The `Instruction` base class — the workflow node extension contract — and its
|
|
11
|
+
* pure logic hooks, relocated to client-v2 so a single definition serves both
|
|
12
|
+
* canvases (ADR-0002 as amended by ADR-0003, doc §2).
|
|
13
|
+
*
|
|
14
|
+
* Only the data/type parts move here. The legacy Formily *rendering*
|
|
15
|
+
* (`Node`, `NodeDefaultView`, the `SchemaComponent` config drawer) stays in
|
|
16
|
+
* `src/client/nodes/index.tsx`. v1 re-exports this class + the pure hooks from
|
|
17
|
+
* here via the allowed `v1 → v2` import direction, so the ~16 node files that
|
|
18
|
+
* `extends Instruction` from the `./nodes` barrel are unchanged.
|
|
19
|
+
*
|
|
20
|
+
* Iron-rule notes:
|
|
21
|
+
* - `ISchema` is a **type-only** import from `@formily/react` (erased at build,
|
|
22
|
+
* zero runtime — explicitly allowed; see the migration skill).
|
|
23
|
+
* - `SchemaInitializerItemType` (the legacy `useInitializers` return type) is
|
|
24
|
+
* NOT imported from `@nocobase/client` (forbidden). It is typed structurally
|
|
25
|
+
* as `unknown` here — the modern canvas never calls `useInitializers` (it
|
|
26
|
+
* uses `getCreateModelMenuItem`), and v1 callers cast as needed.
|
|
27
|
+
*/
|
|
28
|
+
import type { ComponentType } from 'react';
|
|
29
|
+
import type { ISchema } from '@formily/react';
|
|
30
|
+
import type { MetaTreeNode, SubModelItem } from '@nocobase/flow-engine';
|
|
31
|
+
import type { UseVariableOptions, VariableOption } from './collectionFieldOptions';
|
|
32
|
+
/** `() => Promise<{ default: Component }>` loader, matching the trigger `*Loader` convention (doc §9.5). */
|
|
33
|
+
export type LoaderOf<P = {}> = () => Promise<{
|
|
34
|
+
default: ComponentType<P>;
|
|
35
|
+
}>;
|
|
36
|
+
export type NodeAvailableContext = {
|
|
37
|
+
/** The workflow client plugin instance (v1 `WorkflowPlugin` / v2 `PluginWorkflowClientV2`). */
|
|
38
|
+
engine: any;
|
|
39
|
+
workflow: object;
|
|
40
|
+
upstream: object;
|
|
41
|
+
branchIndex: number;
|
|
42
|
+
syncOnly?: boolean;
|
|
43
|
+
};
|
|
44
|
+
type Config = Record<string, any>;
|
|
45
|
+
type Options = {
|
|
46
|
+
label: string;
|
|
47
|
+
value: any;
|
|
48
|
+
}[];
|
|
49
|
+
export type TempAssociationSource = {
|
|
50
|
+
collection: string;
|
|
51
|
+
nodeId: string | number;
|
|
52
|
+
nodeKey: string;
|
|
53
|
+
nodeType: 'workflow' | 'node';
|
|
54
|
+
};
|
|
55
|
+
export declare abstract class Instruction {
|
|
56
|
+
title: string;
|
|
57
|
+
type: string;
|
|
58
|
+
group: string;
|
|
59
|
+
description?: string;
|
|
60
|
+
icon?: JSX.Element;
|
|
61
|
+
async?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* @deprecated migrate to `presetFieldset` instead
|
|
64
|
+
*/
|
|
65
|
+
options?: {
|
|
66
|
+
label: string;
|
|
67
|
+
value: any;
|
|
68
|
+
key: string;
|
|
69
|
+
}[];
|
|
70
|
+
fieldset: Record<string, ISchema>;
|
|
71
|
+
/**
|
|
72
|
+
* @experimental
|
|
73
|
+
*/
|
|
74
|
+
presetFieldset?: Record<string, ISchema>;
|
|
75
|
+
/**
|
|
76
|
+
* @experimental
|
|
77
|
+
*/
|
|
78
|
+
view?: ISchema;
|
|
79
|
+
scope?: Record<string, any>;
|
|
80
|
+
components?: Record<string, any>;
|
|
81
|
+
/** Legacy in-canvas node render (Formily canvas). */
|
|
82
|
+
Component?(props: any): JSX.Element;
|
|
83
|
+
/** Modern in-canvas node render (branch nodes self-render nested `<Branch>`).
|
|
84
|
+
* Absent → the modern canvas uses its default card. */
|
|
85
|
+
ComponentLoader?: LoaderOf<{
|
|
86
|
+
data: any;
|
|
87
|
+
}>;
|
|
88
|
+
/** Modern config-drawer form. Absent → the drawer shows a "not yet migrated"
|
|
89
|
+
* placeholder (never a Formily fallback). */
|
|
90
|
+
FieldsetLoader?: LoaderOf;
|
|
91
|
+
/** Modern add-time preset form (v1 `presetFieldset`). */
|
|
92
|
+
PresetFieldsetLoader?: LoaderOf;
|
|
93
|
+
/**
|
|
94
|
+
* To presentation if the instruction is creating a branch
|
|
95
|
+
* @experimental
|
|
96
|
+
*/
|
|
97
|
+
branching?: boolean | Options | ((config: Config) => boolean | Options);
|
|
98
|
+
/**
|
|
99
|
+
* @experimental
|
|
100
|
+
*/
|
|
101
|
+
createDefaultConfig?(): Config;
|
|
102
|
+
useVariables?(node: any, options?: UseVariableOptions): VariableOption;
|
|
103
|
+
useScopeVariables?(node: any, options?: any): VariableOption[] | MetaTreeNode[];
|
|
104
|
+
/** Legacy block initializer (v1 Schema Initializer). Return type is the
|
|
105
|
+
* legacy `SchemaInitializerItemType`, kept structural to avoid importing
|
|
106
|
+
* `@nocobase/client` into client-v2; v1 callers cast as needed. */
|
|
107
|
+
useInitializers?(node: any): unknown | null;
|
|
108
|
+
/**
|
|
109
|
+
* @experimental
|
|
110
|
+
*/
|
|
111
|
+
isAvailable?(ctx: NodeAvailableContext): boolean;
|
|
112
|
+
end?: boolean | ((node: any) => boolean);
|
|
113
|
+
testable?: boolean;
|
|
114
|
+
/**
|
|
115
|
+
* 2.0 — v2-native block-creation menu item (the `useInitializers` counterpart).
|
|
116
|
+
*/
|
|
117
|
+
getCreateModelMenuItem?({ node, workflow }: {
|
|
118
|
+
node: any;
|
|
119
|
+
workflow: any;
|
|
120
|
+
}): SubModelItem | null;
|
|
121
|
+
/**
|
|
122
|
+
* @experimental
|
|
123
|
+
*/
|
|
124
|
+
useTempAssociationSource?(node: any): TempAssociationSource | null;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* @experimental
|
|
128
|
+
* Walk the upstream chain of a node (exclusive of the node itself), optionally
|
|
129
|
+
* filtered. Pure linked-list traversal — no hooks, despite the `use*` name kept
|
|
130
|
+
* for v1 call-site compatibility.
|
|
131
|
+
*/
|
|
132
|
+
export declare function useAvailableUpstreams(node: any, filter?: any): any[];
|
|
133
|
+
/**
|
|
134
|
+
* @experimental
|
|
135
|
+
* Collect the upstream branching scopes for a node (upstreams that open a
|
|
136
|
+
* branch the node sits inside). Pure traversal.
|
|
137
|
+
*/
|
|
138
|
+
export declare function useUpstreamScopes(node: any): any[];
|
|
139
|
+
export { NodeContext, useNodeContext } from './contexts';
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
import React from 'react';
|
|
10
|
-
export declare function
|
|
11
|
-
|
|
12
|
-
onChange: any;
|
|
10
|
+
export declare function JobButton({ data }: {
|
|
11
|
+
data: any;
|
|
13
12
|
}): React.JSX.Element;
|
|
13
|
+
export default JobButton;
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
* Modern canvas node card (doc §9.5/§9.6). A second copy of the v1 `Node`,
|
|
11
|
+
* rebuilt with native antd + the v2 contexts/registry — it shares no Formily
|
|
12
|
+
* code, but reuses the *same* stylesheet classes (`nodeBlockClass`,
|
|
13
|
+
* `nodeClass`, `nodeCardClass`, `nodeHeaderClass`, `nodeMetaClass`) and DOM
|
|
14
|
+
* shape so the card is visually 1:1 with v1. Renders:
|
|
15
|
+
* - a registered node → type tag + editable title (+ optional `ComponentLoader`
|
|
16
|
+
* self-render for branch nodes);
|
|
17
|
+
* - an unregistered type (only implemented in v1) → a placeholder card,
|
|
18
|
+
* keeping topology intact (mirrors v1's "unknown node" branch, doc §9.1).
|
|
19
|
+
*/
|
|
20
|
+
import React from 'react';
|
|
21
|
+
/**
|
|
22
|
+
* The default node card — type tag + editable title + actions menu, wrapped in
|
|
23
|
+
* the canvas `nodeClass`/`nodeCardClass` chrome (drag mousedown, click-to-open
|
|
24
|
+
* config, copy/drag highlight). Exported and given a `children` slot so a node's
|
|
25
|
+
* `ComponentLoader` can reuse the exact card and append its own subtree after it
|
|
26
|
+
* (e.g. the condition node's Yes/No branches) — the v2 mirror of v1's
|
|
27
|
+
* `NodeDefaultView` (doc §9.5, ADR-0003). Assumes the type is registered; the
|
|
28
|
+
* unregistered placeholder is handled by `NodeCard`.
|
|
29
|
+
*/
|
|
30
|
+
export declare function NodeDefaultView({ data, children }: {
|
|
31
|
+
data: any;
|
|
32
|
+
children?: React.ReactNode;
|
|
33
|
+
}): React.JSX.Element;
|
|
34
|
+
export declare function Node({ data }: {
|
|
35
|
+
data: any;
|
|
36
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,64 @@
|
|
|
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
|
+
* Canvas copy/paste, shared by BOTH canvases (ADR-0003). Copy a node to the
|
|
11
|
+
* clipboard; an add-slot becomes a paste zone; pasting into a position where the
|
|
12
|
+
* node's variable references are no longer in scope prompts to strip them (or
|
|
13
|
+
* keep, with a warning). Pastes via `flow_nodes.duplicate`.
|
|
14
|
+
*
|
|
15
|
+
* The provider's runtime-neutral dependencies (`api`, `t`, antd `modal`/`message`)
|
|
16
|
+
* resolve identically in either runtime (flow-engine `ctx.api`, `useT`,
|
|
17
|
+
* `App.useApp`). The two genuinely runtime-specific bits — the canvas flow data
|
|
18
|
+
* (`{ workflow, nodes, refresh }`) and the `executed` flag — are read through an
|
|
19
|
+
* injected `useCanvasRuntime` hook so each canvas supplies its own source: the
|
|
20
|
+
* modern canvas reads its `FlowContext` + `workflow.executed`, the legacy canvas
|
|
21
|
+
* its own `FlowContext` + `versionStats.executed`. v1 imports this provider from
|
|
22
|
+
* here (the allowed `v1 → v2` direction) and passes its own runtime hook, so a
|
|
23
|
+
* single implementation serves both.
|
|
24
|
+
*/
|
|
25
|
+
import React from 'react';
|
|
26
|
+
type ClipboardNode = {
|
|
27
|
+
sourceId?: number;
|
|
28
|
+
sourceKey?: string;
|
|
29
|
+
type: string;
|
|
30
|
+
title?: string;
|
|
31
|
+
config?: Record<string, any>;
|
|
32
|
+
};
|
|
33
|
+
type PasteImpactItem = {
|
|
34
|
+
key: string;
|
|
35
|
+
title: string;
|
|
36
|
+
};
|
|
37
|
+
type PasteImpact = {
|
|
38
|
+
status: 'safe' | 'warning' | 'disabled';
|
|
39
|
+
impactedSelf: PasteImpactItem[];
|
|
40
|
+
impactedDependents: PasteImpactItem[];
|
|
41
|
+
};
|
|
42
|
+
type NodeClipboardContextValue = {
|
|
43
|
+
clipboard: ClipboardNode | null;
|
|
44
|
+
copyNode: (node: any) => void;
|
|
45
|
+
clearClipboard: () => void;
|
|
46
|
+
getPasteImpact: (target: any) => PasteImpact;
|
|
47
|
+
pasteNode: (target: any) => Promise<void>;
|
|
48
|
+
};
|
|
49
|
+
/** The per-canvas runtime data the provider needs but that differs by runtime —
|
|
50
|
+
* injected via `NodeClipboardContextProvider`'s `useCanvasRuntime` prop. */
|
|
51
|
+
export type CanvasClipboardRuntime = {
|
|
52
|
+
workflow: any;
|
|
53
|
+
nodes: any[] | undefined;
|
|
54
|
+
refresh?: () => void;
|
|
55
|
+
executed: boolean;
|
|
56
|
+
};
|
|
57
|
+
export declare function useNodeClipboardContext(): NodeClipboardContextValue;
|
|
58
|
+
export declare function NodeClipboardContextProvider(props: {
|
|
59
|
+
children: React.ReactNode;
|
|
60
|
+
/** Injected per-canvas runtime source. Defaults to the modern canvas's. The
|
|
61
|
+
* legacy canvas passes its own (v1 `FlowContext` + `versionStats.executed`). */
|
|
62
|
+
useCanvasRuntime?: () => CanvasClipboardRuntime;
|
|
63
|
+
}): React.JSX.Element;
|
|
64
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import type { Instruction } from './Instruction';
|
|
10
|
+
/**
|
|
11
|
+
* Open the node config drawer for a node. Call from a card click handler.
|
|
12
|
+
* `ctx` is the flow-engine context (from `useFlowContext()`).
|
|
13
|
+
*
|
|
14
|
+
* `workflow` is threaded in explicitly because the drawer renders at the React
|
|
15
|
+
* root (`ctx.viewer.drawer`), OUTSIDE the canvas `FlowContext.Provider` — so the
|
|
16
|
+
* config form can't read the workflow from the canvas tree. It is re-provided via
|
|
17
|
+
* `CurrentWorkflowContext`, and the legacy canvas `FlowContext` is mirrored with
|
|
18
|
+
* the same workflow so reused v1 hooks still resolve inside migrated drawers.
|
|
19
|
+
*/
|
|
20
|
+
export declare function openNodeConfigDrawer(opts: {
|
|
21
|
+
ctx: any;
|
|
22
|
+
data: any;
|
|
23
|
+
instruction?: Instruction;
|
|
24
|
+
t: (key: string, options?: Record<string, any>) => string;
|
|
25
|
+
workflow?: any;
|
|
26
|
+
refresh?: () => void;
|
|
27
|
+
}): void;
|
|
@@ -0,0 +1,83 @@
|
|
|
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
|
+
* Canvas node drag-to-reorder, shared by BOTH canvases (ADR-0003, doc §9.6). The
|
|
11
|
+
* ~700-line pointer machinery (mousemove tracking, RAF drag preview, auto-scroll,
|
|
12
|
+
* drop-zone hit-testing, the move API) is framework-agnostic DOM logic; the
|
|
13
|
+
* runtime-specific bits at the top (`api`, the i18n functions, the instruction
|
|
14
|
+
* registry, the executed flag) are read through an injected `useCanvasRuntime`
|
|
15
|
+
* so v1 can re-import this single provider and pass its own runtime (the allowed
|
|
16
|
+
* v1 → v2 direction). `workflow`/`nodes`/`refresh` come from the now-shared
|
|
17
|
+
* `FlowContext` directly, and the pure graph walks from the relocated modules.
|
|
18
|
+
*/
|
|
19
|
+
import React from 'react';
|
|
20
|
+
import { type CanvasNode } from './contexts';
|
|
21
|
+
import type { Instruction } from './Instruction';
|
|
22
|
+
/** Per-canvas runtime the drag provider needs but that differs by runtime —
|
|
23
|
+
* injected via `NodeDragContextProvider`'s `useCanvasRuntime` prop. */
|
|
24
|
+
export type CanvasDragRuntime = {
|
|
25
|
+
api: any;
|
|
26
|
+
/** Plain-key translation (no `{{t("…")}}` expansion) — v1 `lang`, v2 `useWorkflowTranslation().t`. */
|
|
27
|
+
lang: (key: string, options?: Record<string, unknown>) => string;
|
|
28
|
+
/** Template expander for instruction titles (`{{t("…")}}`) — v1 `useCompile()`, v2 `useT()`. */
|
|
29
|
+
compile: (source: string) => string;
|
|
30
|
+
/** Resolve an instruction by type — for the drag-preview node title. */
|
|
31
|
+
getInstruction: (type: string) => Instruction | undefined;
|
|
32
|
+
/** Whether the workflow has been executed (read-only) — the move API is disabled. */
|
|
33
|
+
executed: boolean;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* A drop target: the add-slot's position in the graph, identified by its upstream
|
|
37
|
+
* node (`null`/absent = the root slot) and, for a branch slot, its branch index.
|
|
38
|
+
* Built by `AddNodeSlot`'s `DropZone` as `{ upstream, branchIndex }`.
|
|
39
|
+
*/
|
|
40
|
+
export type DropTarget = {
|
|
41
|
+
upstream?: CanvasNode | null;
|
|
42
|
+
branchIndex?: number | null;
|
|
43
|
+
};
|
|
44
|
+
/** The result of dropping the dragged node onto a target: whether the move is
|
|
45
|
+
* allowed (`safe`), allowed-with-consequences (`warning` — lists the nodes whose
|
|
46
|
+
* variable references would break), or forbidden (`disabled`). */
|
|
47
|
+
export type DropImpact = {
|
|
48
|
+
status: 'safe' | 'warning' | 'disabled';
|
|
49
|
+
impactedSelf: CanvasNode[];
|
|
50
|
+
impactedDependents: CanvasNode[];
|
|
51
|
+
};
|
|
52
|
+
/** The minimal node snapshot driving the floating drag preview (set on drag start,
|
|
53
|
+
* read by the preview-rendering effect). */
|
|
54
|
+
export type DragPreviewNode = {
|
|
55
|
+
id: number;
|
|
56
|
+
key?: string;
|
|
57
|
+
title?: string;
|
|
58
|
+
type?: string;
|
|
59
|
+
hasBranches: boolean;
|
|
60
|
+
};
|
|
61
|
+
/** What `useNodeDragContext()` exposes to node cards / add-slots / the canvas. */
|
|
62
|
+
export type NodeDragContextValue = {
|
|
63
|
+
dragging: boolean;
|
|
64
|
+
dragNode: DragPreviewNode | null;
|
|
65
|
+
onNodeMouseDown: (node: CanvasNode, event: React.MouseEvent) => void;
|
|
66
|
+
getDropImpact: (target: DropTarget) => DropImpact;
|
|
67
|
+
setActiveDrop: (target: DropTarget | null) => void;
|
|
68
|
+
clearActiveDrop: (target: DropTarget) => void;
|
|
69
|
+
/** Registers an add-slot's DOM element as a drop zone; returns a cleanup fn
|
|
70
|
+
* that unregisters it (used directly as a `useEffect` teardown). */
|
|
71
|
+
registerDropZone: (target: DropTarget, element: HTMLElement | null) => () => void;
|
|
72
|
+
getDropKey: (target: DropTarget) => string;
|
|
73
|
+
activeDropKey: string | null;
|
|
74
|
+
consumeClick: () => boolean;
|
|
75
|
+
};
|
|
76
|
+
export declare function useNodeDragContext(): NodeDragContextValue;
|
|
77
|
+
export declare function NodeDragContextProvider(props: {
|
|
78
|
+
children: React.ReactNode;
|
|
79
|
+
/** Injected per-canvas runtime source. Defaults to the modern canvas's; the
|
|
80
|
+
* legacy canvas passes its own (v1 `useAPIClient` / `lang` / `useCompile` /
|
|
81
|
+
* `usePlugin` registry / `useWorkflowExecuted`). */
|
|
82
|
+
useCanvasRuntime?: () => CanvasDragRuntime;
|
|
83
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,45 @@
|
|
|
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
|
+
* Canvas remove-node flow, shared by BOTH canvases (ADR-0003, doc §9.6). A leaf
|
|
11
|
+
* node deletes after the variable-reference safety check (blocked when another
|
|
12
|
+
* node still references its result, else a confirm); a branching node opens a
|
|
13
|
+
* "keep which branch" modal, then runs the same safety check over the kept-branch
|
|
14
|
+
* + downstream subtree before deleting. Deletes via `flow_nodes.destroy` + refresh.
|
|
15
|
+
*
|
|
16
|
+
* This aligns the modern canvas to v1: the previous v2 implementation deleted
|
|
17
|
+
* immediately and skipped the reference guard entirely. The check logic is the
|
|
18
|
+
* shared pure `findNodesReferencing` / `collectBranchNodes`; the runtime-specific
|
|
19
|
+
* bits (`api`, `nodes`, `refresh`, the instruction registry for branch labels)
|
|
20
|
+
* are read through an injected `useCanvasRuntime` so v1 can re-import this single
|
|
21
|
+
* provider and pass its own runtime (the allowed v1 → v2 direction).
|
|
22
|
+
*/
|
|
23
|
+
import React from 'react';
|
|
24
|
+
type RemoveNodeContextValue = {
|
|
25
|
+
/** Request deletion of a node — runs the safety check and confirm/keep-branch
|
|
26
|
+
* flow, then deletes. Mirrors v1's `RemoveButton.onRemove`. */
|
|
27
|
+
requestRemove: (node: any) => void;
|
|
28
|
+
};
|
|
29
|
+
/** Per-canvas runtime the provider needs but that differs by runtime — injected
|
|
30
|
+
* via `RemoveNodeContextProvider`'s `useCanvasRuntime` prop. */
|
|
31
|
+
export type CanvasRemoveRuntime = {
|
|
32
|
+
api: any;
|
|
33
|
+
nodes: any[] | undefined;
|
|
34
|
+
refresh?: () => void;
|
|
35
|
+
/** Resolve an instruction by type — for the branch-label `branching` metadata. */
|
|
36
|
+
getInstruction: (type: string) => any;
|
|
37
|
+
};
|
|
38
|
+
export declare function useRemoveNodeContext(): RemoveNodeContextValue;
|
|
39
|
+
export declare function RemoveNodeContextProvider(props: {
|
|
40
|
+
children: React.ReactNode;
|
|
41
|
+
/** Injected per-canvas runtime source. Defaults to the modern canvas's; the
|
|
42
|
+
* legacy canvas passes its own (v1 `FlowContext` + `usePlugin` registry). */
|
|
43
|
+
useCanvasRuntime?: () => CanvasRemoveRuntime;
|
|
44
|
+
}): React.JSX.Element;
|
|
45
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import { type TypedConstantSpec, type TypedVariableInputProps } from '@nocobase/client-v2';
|
|
11
|
+
import { type UseWorkflowVariableOptions } from './useWorkflowVariableOptions';
|
|
12
|
+
export declare const WORKFLOW_TYPED_CONSTANT_TYPES: TypedConstantSpec[];
|
|
13
|
+
export type WorkflowTypedVariableInputProps = Omit<TypedVariableInputProps, 'extraNodes' | 'metaTree' | 'namespaces'> & {
|
|
14
|
+
variableOptions?: UseWorkflowVariableOptions;
|
|
15
|
+
};
|
|
16
|
+
export declare function WorkflowTypedVariableInput({ variableOptions, ...rest }: WorkflowTypedVariableInputProps): React.JSX.Element;
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
* The v2 workflow variable picker (doc §5). A downstream node author drops this
|
|
11
|
+
* into a `FieldsetLoader` form like any antd input — it reads the current node
|
|
12
|
+
* from NodeContext and the upstream chain itself, so the author never wires
|
|
13
|
+
* context.
|
|
14
|
+
*
|
|
15
|
+
* It reuses flow-engine's low-level `VariableHybridInput` (fed a
|
|
16
|
+
* workflow-constructed `MetaTreeNode` tree from `useWorkflowVariableOptions`),
|
|
17
|
+
* NOT the top-level global `VariableInput` (whose tree is the global registry).
|
|
18
|
+
*
|
|
19
|
+
* Workflow variables serialize as `{{$jobsMapByNodeKey.<nodeKey>.<field>}}` —
|
|
20
|
+
* the adapter already builds `paths` as `['$jobsMapByNodeKey', nodeKey, …]`, so
|
|
21
|
+
* the converters here just join/split that path inside `{{ }}`.
|
|
22
|
+
*/
|
|
23
|
+
import React from 'react';
|
|
24
|
+
import { type UseWorkflowVariableOptions } from './useWorkflowVariableOptions';
|
|
25
|
+
export type WorkflowVariableInputProps = {
|
|
26
|
+
value?: string;
|
|
27
|
+
onChange?: (value: string) => void;
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
placeholder?: string;
|
|
30
|
+
className?: string;
|
|
31
|
+
style?: React.CSSProperties;
|
|
32
|
+
/** Validation status (red/amber border). Usually omitted — inside a
|
|
33
|
+
* `Form.Item` the status is inherited automatically. */
|
|
34
|
+
status?: 'error' | 'warning';
|
|
35
|
+
/** Variable-tree options forwarded to each upstream `useVariables` (types
|
|
36
|
+
* filter, appends, depth, fieldNames). */
|
|
37
|
+
variableOptions?: UseWorkflowVariableOptions;
|
|
38
|
+
};
|
|
39
|
+
export declare function WorkflowVariableInput(props: WorkflowVariableInputProps): React.JSX.Element;
|
|
@@ -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
|
+
import { type JsonTextAreaProps } from '@nocobase/client-v2';
|
|
10
|
+
import React from 'react';
|
|
11
|
+
import { type UseWorkflowVariableOptions } from './useWorkflowVariableOptions';
|
|
12
|
+
export interface WorkflowVariableJsonTextAreaProps extends JsonTextAreaProps {
|
|
13
|
+
variableOptions?: UseWorkflowVariableOptions;
|
|
14
|
+
}
|
|
15
|
+
export declare function WorkflowVariableJsonTextArea(props: WorkflowVariableJsonTextAreaProps): React.JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import type { TextAreaProps } from 'antd/es/input';
|
|
10
|
+
import React from 'react';
|
|
11
|
+
import { type UseWorkflowVariableOptions } from './useWorkflowVariableOptions';
|
|
12
|
+
export interface WorkflowVariableTextAreaProps extends Omit<TextAreaProps, 'value' | 'onChange'> {
|
|
13
|
+
value?: string;
|
|
14
|
+
onChange?: (value: string) => void;
|
|
15
|
+
variableOptions?: UseWorkflowVariableOptions;
|
|
16
|
+
delimiters?: readonly [string, string];
|
|
17
|
+
}
|
|
18
|
+
export declare function WorkflowVariableTextArea(props: WorkflowVariableTextAreaProps): React.JSX.Element;
|
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
* Single, core, one-way adapter `VariableOption → MetaTreeNode` (ADR-0003,
|
|
11
|
+
* migration doc §6). The modern canvas reuses the mature legacy field-tree
|
|
12
|
+
* logic (`getCollectionFieldOptions`, which returns `VariableOption`) unchanged,
|
|
13
|
+
* and converts its aggregated upstream variables to the flow-engine
|
|
14
|
+
* `MetaTreeNode` shape with this adapter just before feeding `VariableHybridInput`.
|
|
15
|
+
*
|
|
16
|
+
* Pure, side-effect-free, React-context-free — so it is independently unit
|
|
17
|
+
* testable and the whole suite is deletable in one move when the legacy
|
|
18
|
+
* field-tree logic is finally rewritten to produce `MetaTreeNode` natively.
|
|
19
|
+
*
|
|
20
|
+
* The modern consumers (`FlowContextSelector` cascader, `VariableHybridInput.walk`,
|
|
21
|
+
* `VariableTag`) read exactly 7 `MetaTreeNode` fields; this adapter maps:
|
|
22
|
+
* title ← label (reactNode preserved; walk plain-texts it)
|
|
23
|
+
* name ← value (or label) direct, with name fallback
|
|
24
|
+
* children ← children / loadChildren → () => Promise<MetaTreeNode[]>
|
|
25
|
+
* disabled ← disabled direct
|
|
26
|
+
* disabledReason ← (v1 has none) left undefined
|
|
27
|
+
* type/interface ← field.type/.interface (only used by custom render)
|
|
28
|
+
* paths ← (no v1 counterpart) constructed here, accumulated down
|
|
29
|
+
* the recursion (incl. lazy children).
|
|
30
|
+
*
|
|
31
|
+
* The v1-only keys (`field`/`types`/`appends`/`depth`) are captured in the
|
|
32
|
+
* `loadChildren` closure and never surface on the produced `MetaTreeNode`.
|
|
33
|
+
*/
|
|
34
|
+
import type { MetaTreeNode } from '@nocobase/flow-engine';
|
|
35
|
+
import type { VariableOption } from './collectionFieldOptions';
|
|
36
|
+
/**
|
|
37
|
+
* @param option a single VariableOption (as produced by getCollectionFieldOptions
|
|
38
|
+
* / useWorkflowVariableOptions).
|
|
39
|
+
* @param parentPaths the path array accumulated from the root down to (but not
|
|
40
|
+
* including) this node. Top-level callers pass `[]` (or a custom
|
|
41
|
+
* root prefix, e.g. `['$jobsMapByNodeKey', nodeKey]`).
|
|
42
|
+
*/
|
|
43
|
+
export declare function adaptVariableOptionToMetaTree(option: VariableOption, parentPaths?: string[]): MetaTreeNode;
|
|
44
|
+
/**
|
|
45
|
+
* Adapt a list of top-level options (e.g. one aggregated variable scope) under
|
|
46
|
+
* an optional root path prefix.
|
|
47
|
+
*/
|
|
48
|
+
export declare function adaptVariableOptionsToMetaTree(options: VariableOption[], rootPaths?: string[]): MetaTreeNode[];
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import type { Instruction } from './Instruction';
|
|
10
|
+
import type { SharedAddNodeAnchor } from './AddNodeContext.shared';
|
|
11
|
+
export type AddNodeControllerRuntime = {
|
|
12
|
+
workflow: any;
|
|
13
|
+
nodes: any[];
|
|
14
|
+
getInstruction: (type: string) => Instruction | undefined;
|
|
15
|
+
getInstructionAvailable?: (instruction: Instruction, context: Record<string, any>) => string | null;
|
|
16
|
+
translateTitle: (title: string) => string;
|
|
17
|
+
api: any;
|
|
18
|
+
refresh?: () => void;
|
|
19
|
+
};
|
|
20
|
+
export type AddNodeDraft = {
|
|
21
|
+
key: string;
|
|
22
|
+
type: string;
|
|
23
|
+
upstreamId: any;
|
|
24
|
+
branchIndex: number | null | undefined;
|
|
25
|
+
title: string;
|
|
26
|
+
config: Record<string, any>;
|
|
27
|
+
};
|
|
28
|
+
export type AddNodeDecision = {
|
|
29
|
+
kind: 'missing';
|
|
30
|
+
type: string;
|
|
31
|
+
} | {
|
|
32
|
+
kind: 'blocked';
|
|
33
|
+
message: string;
|
|
34
|
+
instruction: Instruction;
|
|
35
|
+
} | {
|
|
36
|
+
kind: 'legacy-preset';
|
|
37
|
+
instruction: Instruction;
|
|
38
|
+
draft: AddNodeDraft;
|
|
39
|
+
} | {
|
|
40
|
+
kind: 'modern-preset';
|
|
41
|
+
instruction: Instruction;
|
|
42
|
+
anchor: SharedAddNodeAnchor;
|
|
43
|
+
hasDownstream: boolean;
|
|
44
|
+
} | {
|
|
45
|
+
kind: 'branch-fallback';
|
|
46
|
+
instruction: Instruction;
|
|
47
|
+
draft: AddNodeDraft;
|
|
48
|
+
} | {
|
|
49
|
+
kind: 'direct';
|
|
50
|
+
instruction: Instruction;
|
|
51
|
+
draft: AddNodeDraft;
|
|
52
|
+
};
|
|
53
|
+
export declare function findDownstream(nodes?: any[], upstream?: any, branchIndex?: number | null): any;
|
|
54
|
+
export declare function createNodeDraft({ instruction, anchor, translateTitle, }: {
|
|
55
|
+
instruction: Instruction;
|
|
56
|
+
anchor: SharedAddNodeAnchor;
|
|
57
|
+
translateTitle: (title: string) => string;
|
|
58
|
+
}): AddNodeDraft;
|
|
59
|
+
export declare function resolveAddNodeDecision({ type, anchor, runtime, }: {
|
|
60
|
+
type: string;
|
|
61
|
+
anchor: SharedAddNodeAnchor;
|
|
62
|
+
runtime: Pick<AddNodeControllerRuntime, 'workflow' | 'nodes' | 'getInstruction' | 'getInstructionAvailable' | 'translateTitle'>;
|
|
63
|
+
}): AddNodeDecision;
|
|
64
|
+
export declare function createNodeAndMaybeReparent({ workflowId, api, refresh, values, downstreamBranchIndex, }: {
|
|
65
|
+
workflowId: any;
|
|
66
|
+
api: any;
|
|
67
|
+
refresh?: () => void;
|
|
68
|
+
values: Record<string, any>;
|
|
69
|
+
downstreamBranchIndex?: number | null;
|
|
70
|
+
}): Promise<any>;
|