@digitalsee-ai/rcs 1.1.2 → 1.1.4
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/dist/components/digitalsee/workflow/Canvas/FlowVersionManager.d.ts +15 -0
- package/dist/components/digitalsee/workflow/Canvas/WorkflowCanvas.test.d.ts +1 -0
- package/dist/components/digitalsee/workflow/Canvas/WorkflowCanvasHeader.d.ts +3 -1
- package/dist/components/digitalsee/workflow/Canvas/actionItemToNodeData.d.ts +14 -0
- package/dist/components/digitalsee/workflow/Canvas/constants.d.ts +4 -20
- package/dist/components/digitalsee/workflow/Canvas/constants.test.d.ts +1 -0
- package/dist/components/digitalsee/workflow/Canvas/flowPayload.d.ts +4 -0
- package/dist/components/digitalsee/workflow/Canvas/hooks/classicNodeAddConnection.d.ts +31 -0
- package/dist/components/digitalsee/workflow/Canvas/hooks/classicNodeAddConnection.test.d.ts +1 -0
- package/dist/components/digitalsee/workflow/Canvas/hooks/createNodeAddHandlerNext.d.ts +1 -16
- package/dist/components/digitalsee/workflow/Canvas/hooks/useCanvasApi.d.ts +1 -1
- package/dist/components/digitalsee/workflow/Canvas/hooks/useNodeAddCallback.d.ts +4 -17
- package/dist/components/digitalsee/workflow/Canvas/hooks/useSaveFlowAfterNodeAdd.d.ts +9 -0
- package/dist/components/digitalsee/workflow/Canvas/hooks/useWorkflowCanvasState.d.ts +4 -2
- package/dist/components/digitalsee/workflow/Canvas/types.d.ts +8 -1
- package/dist/components/digitalsee/workflow/Handles/CustomHandle.d.ts +3 -0
- package/dist/components/digitalsee/workflow/Handles/customHandleConnectable.d.ts +35 -0
- package/dist/components/digitalsee/workflow/Handles/customHandleConnectable.test.d.ts +1 -0
- package/dist/components/digitalsee/workflow/Nodes/ConditionNode.d.ts +1 -1
- package/dist/components/digitalsee/workflow/Nodes/SuperBaseNode.d.ts +6 -1
- package/dist/components/digitalsee/workflow/Nodes/SwitchNode.d.ts +2 -2
- package/dist/components/digitalsee/workflow/Nodes/classicNodePackageNodes.test.d.ts +1 -0
- package/dist/components/digitalsee/workflow/Nodes/classicNodePackagePortLayout.d.ts +23 -0
- package/dist/components/digitalsee/workflow/Nodes/classicNodePackagePortLayout.test.d.ts +1 -0
- package/dist/components/digitalsee/workflow/Nodes/useClassicNodePackagePorts.d.ts +27 -0
- package/dist/components/digitalsee/workflow/Nodes/useClassicNodePackagePorts.test.d.ts +1 -0
- package/dist/components/digitalsee/workflow/NodesConfig/ActionNodeConfig/index.d.ts +1 -0
- package/dist/components/digitalsee/workflow/NodesConfig/NextNodeConfig/WorkflowNodeSchemaFieldProvider.d.ts +3 -0
- package/dist/components/digitalsee/workflow/NodesConfig/NextNodeConfig/fields/WorkflowCodeField.d.ts +1 -0
- package/dist/components/digitalsee/workflow/NodesConfig/NextNodeConfig/fields/WorkflowCodeField.test.d.ts +1 -0
- package/dist/components/digitalsee/workflow/NodesConfig/NextNodeConfig/fields/WorkflowProxyField.d.ts +1 -0
- package/dist/components/digitalsee/workflow/NodesConfig/NextNodeConfig/proxyField.d.ts +18 -0
- package/dist/components/digitalsee/workflow/NodesConfig/NextNodeConfig/proxyField.test.d.ts +1 -0
- package/dist/components/digitalsee/workflow/NodesConfig/components/EditInOnlineIDE/index.d.ts +2 -0
- package/dist/components/digitalsee/workflow/NodesConfig/components/FormFieldRenderer/index.d.ts +1 -0
- package/dist/components/digitalsee/workflow/NodesConfig/components/online-ide/components/title/index.d.ts +5 -1
- package/dist/components/digitalsee/workflow/NodesConfig/components/online-ide/index.d.ts +2 -0
- package/dist/components/digitalsee/workflow/Panels/ModernNodeSelectorPanel/components/EntryTypeSelector.d.ts +8 -0
- package/dist/components/digitalsee/workflow/Panels/ModernNodeSelectorPanel/components/NodeCardList.d.ts +19 -0
- package/dist/components/digitalsee/workflow/Panels/ModernNodeSelectorPanel/hooks/useCategories.d.ts +6 -2
- package/dist/components/digitalsee/workflow/Panels/ModernNodeSelectorPanel/hooks/useCategories.test.d.ts +1 -0
- package/dist/components/digitalsee/workflow/Panels/ModernNodeSelectorPanel/hooks/useConnectableNodeSelector.d.ts +40 -0
- package/dist/components/digitalsee/workflow/Panels/ModernNodeSelectorPanel/hooks/useNavigation.d.ts +4 -2
- package/dist/components/digitalsee/workflow/Panels/ModernNodeSelectorPanel/hooks/useNavigation.test.d.ts +1 -0
- package/dist/components/digitalsee/workflow/Panels/ModernNodeSelectorPanel/hooks/useNodeActionState.d.ts +30 -0
- package/dist/components/digitalsee/workflow/Panels/ModernNodeSelectorPanel/hooks/useNodeSelectorPresentation.d.ts +25 -0
- package/dist/components/digitalsee/workflow/Panels/ModernNodeSelectorPanel/hooks/useNodeSelectorPresentation.test.d.ts +1 -0
- package/dist/components/digitalsee/workflow/Panels/ModernNodeSelectorPanel/types.d.ts +19 -1
- package/dist/components/digitalsee/workflow/Panels/ModernNodeSelectorPanel/utils/connectableActionLoader.d.ts +16 -0
- package/dist/components/digitalsee/workflow/Panels/ModernNodeSelectorPanel/utils/connectableActionLoader.test.d.ts +1 -0
- package/dist/components/digitalsee/workflow/Panels/ModernNodeSelectorPanel/utils/connectableDataSource.d.ts +15 -0
- package/dist/components/digitalsee/workflow/Panels/ModernNodeSelectorPanel/utils/connectableDataSource.test.d.ts +1 -0
- package/dist/components/digitalsee/workflow/Panels/ModernNodeSelectorPanel/utils/connectableFallback.d.ts +2 -0
- package/dist/components/digitalsee/workflow/Panels/ModernNodeSelectorPanel/utils/connectableFallback.test.d.ts +1 -0
- package/dist/components/digitalsee/workflow/Panels/ModernNodeSelectorPanel/utils/connectableQuery.d.ts +40 -0
- package/dist/components/digitalsee/workflow/Panels/ModernNodeSelectorPanel/utils/connectableQuery.test.d.ts +1 -0
- package/dist/components/digitalsee/workflow/Panels/ModernNodeSelectorPanel/utils/connectableResponse.d.ts +35 -0
- package/dist/components/digitalsee/workflow/Panels/ModernNodeSelectorPanel/utils/connectableResponse.test.d.ts +1 -0
- package/dist/components/digitalsee/workflow/Panels/ModernNodeSelectorPanel/utils/dataTransformers.d.ts +13 -2
- package/dist/components/digitalsee/workflow/Panels/ModernNodeSelectorPanel/utils/filterEdgeInsertActions.d.ts +62 -0
- package/dist/components/digitalsee/workflow/Panels/ModernNodeSelectorPanel/utils/filterEdgeInsertActions.test.d.ts +1 -0
- package/dist/components/digitalsee/workflow/Panels/ModernNodeSelectorPanel/utils/nodeAddContext.d.ts +26 -0
- package/dist/components/digitalsee/workflow/Panels/ModernNodeSelectorPanel/utils/nodeAddContext.test.d.ts +1 -0
- package/dist/components/digitalsee/workflow/api/connectable.test.d.ts +1 -0
- package/dist/components/digitalsee/workflow/api/connectable.types.d.ts +75 -0
- package/dist/components/digitalsee/workflow/api/dip.types.d.ts +43 -3
- package/dist/components/digitalsee/workflow/api/index.d.ts +28 -1
- package/dist/components/digitalsee/workflow/config/defaultCanvasEngineConfig.test.d.ts +1 -0
- package/dist/components/digitalsee/workflow/config/defaultNodeSelectorConfig.d.ts +9 -0
- package/dist/components/digitalsee/workflow/events/eventBus.d.ts +2 -12
- package/dist/components/digitalsee/workflow/hooks/usePanel.d.ts +3 -17
- package/dist/components/digitalsee/workflow/index.d.ts +3 -1
- package/dist/components/digitalsee/workflow/store/panelSlice.d.ts +118 -41
- package/dist/components/digitalsee/workflow/store/workflowSlice.d.ts +2 -1
- package/dist/components/digitalsee/workflow/types/Node.d.ts +3 -3
- package/dist/components/digitalsee/workflow/types/NodeAddContext.d.ts +31 -0
- package/dist/components/digitalsee/workflow/types/engine.d.ts +21 -1
- package/dist/components/digitalsee/workflow/types/flowVersion.d.ts +53 -0
- package/dist/components/digitalsee/workflow/utils/classicNodeActionIdentity.d.ts +7 -0
- package/dist/components/digitalsee/workflow/utils/classicNodeActionIdentity.test.d.ts +1 -0
- package/dist/components/digitalsee/workflow/utils/classicNodePackageConnection.d.ts +28 -0
- package/dist/components/digitalsee/workflow/utils/classicNodePackageConnection.test.d.ts +1 -0
- package/dist/components/digitalsee/workflow/utils/classicNodePackageGraphValidation.d.ts +29 -0
- package/dist/components/digitalsee/workflow/utils/classicNodePackageGraphValidation.test.d.ts +1 -0
- package/dist/components/digitalsee/workflow/utils/compatiblePortSelection.d.ts +79 -0
- package/dist/components/digitalsee/workflow/utils/compatiblePortSelection.test.d.ts +1 -0
- package/dist/components/digitalsee/workflow/utils/nextNodeSchemaCache.d.ts +8 -0
- package/dist/components/digitalsee/workflow/utils/nodeDataFormatter.test.d.ts +1 -0
- package/dist/components/digitalsee/workflow/utils/portConnectionValidationMessages.d.ts +48 -0
- package/dist/components/digitalsee/workflow/utils/portConnectionValidationMessages.test.d.ts +1 -0
- package/dist/components/digitalsee/workflow/utils/portConnectionValidator.d.ts +66 -0
- package/dist/components/digitalsee/workflow/utils/portConnectionValidator.test.d.ts +1 -0
- package/dist/components/digitalsee/workflow/utils/switchNodePackage.d.ts +43 -0
- package/dist/components/digitalsee/workflow/utils/switchNodePackage.test.d.ts +1 -0
- package/dist/components/digitalsee/workflow/utils/workflowConnectionValidator.d.ts +20 -0
- package/dist/components/digitalsee/workflow/utils/workflowConnectionValidator.test.d.ts +1 -0
- package/dist/components/dynamic-form/DynamicForm.d.ts +7 -1
- package/dist/components/dynamic-form/components/ValueModeWrapper/ValueModePolicy.test.d.ts +1 -0
- package/dist/components/dynamic-form/components/ValueModeWrapper/index.d.ts +23 -3
- package/dist/components/dynamic-form/registry/createFieldComponent.d.ts +4 -4
- package/dist/components/dynamic-form/types/field-component.d.ts +1 -1
- package/dist/components/dynamic-form/types/form-schema.d.ts +10 -1
- package/dist/index-DVB8Tfvb.mjs +63909 -0
- package/dist/index-DVB8Tfvb.mjs.map +1 -0
- package/dist/index-DuXBchhk.mjs +312 -0
- package/dist/index-DuXBchhk.mjs.map +1 -0
- package/dist/locales/en-US/common.d.ts +52 -0
- package/dist/locales/en-US/link/flow.d.ts +25 -0
- package/dist/locales/en-US.d.ts +77 -0
- package/dist/locales/zh-CN/common.d.ts +52 -0
- package/dist/locales/zh-CN/link/flow.d.ts +25 -0
- package/dist/locales/zh-CN.d.ts +77 -0
- package/dist/locales/zh-TW/common.d.ts +52 -0
- package/dist/locales/zh-TW/link/flow.d.ts +25 -0
- package/dist/locales/zh-TW.d.ts +77 -0
- package/dist/rcs.css +1 -1
- package/dist/rcs.es.js +60 -61089
- package/dist/rcs.es.js.map +1 -1
- package/dist/rcs.umd.js +65 -65
- package/dist/rcs.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { PortConnectionValidationResult } from './portConnectionValidator';
|
|
2
|
+
import { TranslateFn } from '../../../../locales';
|
|
3
|
+
/** 供选择器、自动连线和已有边检查复用的 connectable 界面文案。 */
|
|
4
|
+
export declare const CONNECTABLE_UI_MESSAGE_IDS: {
|
|
5
|
+
readonly categoryUnavailable: "link.flow.connectable.category_unavailable";
|
|
6
|
+
readonly connectorUnavailable: "link.flow.connectable.connector_unavailable";
|
|
7
|
+
readonly actionUnavailable: "link.flow.connectable.action_unavailable";
|
|
8
|
+
readonly loadFailed: "link.flow.connectable.load_failed";
|
|
9
|
+
readonly noCompatibleNodes: "link.flow.connectable.no_compatible_nodes";
|
|
10
|
+
readonly noCompatibleInput: "link.flow.connectable.no_compatible_input";
|
|
11
|
+
readonly noCompatibleOutput: "link.flow.connectable.no_compatible_output";
|
|
12
|
+
readonly noBidirectionalCompatiblePort: "link.flow.connectable.no_bidirectional_compatible_port";
|
|
13
|
+
readonly schemaUnavailable: "link.flow.connectable.schema_unavailable";
|
|
14
|
+
readonly existingEdgeInvalid: "link.flow.connectable.existing_edge_invalid";
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* 端口校验错误码与 RCS 内置文案的唯一映射。
|
|
18
|
+
*
|
|
19
|
+
* 使用 `satisfies` 保证校验器新增 code 时这里会产生类型错误,避免界面静默回退成中文
|
|
20
|
+
* `reason`。`reason` 仍保留给未知后端规则或版本不一致场景作运行时兜底。
|
|
21
|
+
*/
|
|
22
|
+
export declare const PORT_CONNECTION_VALIDATION_MESSAGE_IDS: {
|
|
23
|
+
readonly SOURCE_NODE_NOT_FOUND: "link.flow.connectable.validation.source_node_not_found";
|
|
24
|
+
readonly TARGET_NODE_NOT_FOUND: "link.flow.connectable.validation.target_node_not_found";
|
|
25
|
+
readonly SOURCE_PORT_NOT_FOUND: "link.flow.connectable.validation.source_port_not_found";
|
|
26
|
+
readonly TARGET_PORT_NOT_FOUND: "link.flow.connectable.validation.target_port_not_found";
|
|
27
|
+
readonly PORT_TYPE_MISMATCH: "link.flow.connectable.validation.port_type_mismatch";
|
|
28
|
+
readonly SOURCE_NODE_NOT_ALLOWED: "link.flow.connectable.validation.source_node_not_allowed";
|
|
29
|
+
readonly TARGET_NODE_NOT_ALLOWED: "link.flow.connectable.validation.target_node_not_allowed";
|
|
30
|
+
readonly SOURCE_NODE_DENIED: "link.flow.connectable.validation.source_node_denied";
|
|
31
|
+
readonly TARGET_NODE_DENIED: "link.flow.connectable.validation.target_node_denied";
|
|
32
|
+
readonly SOURCE_MAX_CONNECTIONS_REACHED: "link.flow.connectable.validation.source_max_connections_reached";
|
|
33
|
+
readonly TARGET_MAX_CONNECTIONS_REACHED: "link.flow.connectable.validation.target_max_connections_reached";
|
|
34
|
+
readonly SELF_CONNECTION_NOT_ALLOWED: "link.flow.connectable.validation.self_connection_not_allowed";
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* 将端口连接校验结果转为当前 locale 的用户文案。
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts
|
|
41
|
+
* const intl = useIntl();
|
|
42
|
+
* const text = formatPortConnectionValidationMessage(
|
|
43
|
+
* validationResult,
|
|
44
|
+
* (id, values) => intl.formatMessage({ id }, values),
|
|
45
|
+
* );
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export declare const formatPortConnectionValidationMessage: (result: PortConnectionValidationResult, translate: TranslateFn) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { DipPortSchema } from '../api/dip.types';
|
|
2
|
+
export declare const DEFAULT_PORT_CONNECTION_TYPE = "main";
|
|
3
|
+
/** 已完成运行时默认值归一化的端口 Schema。 */
|
|
4
|
+
export interface NormalizedDipPortSchema extends DipPortSchema {
|
|
5
|
+
type: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* 校验器所需的最小节点结构,可直接接收 ReactFlow Node。
|
|
9
|
+
*
|
|
10
|
+
* 节点 schema key 必须放在 data.action_key/actionKey/nodeKey/node_key 中;
|
|
11
|
+
* ReactFlow 的 node.type 只是渲染类型,不能作为连接白名单身份。
|
|
12
|
+
*/
|
|
13
|
+
export interface PortConnectionNode {
|
|
14
|
+
id: string;
|
|
15
|
+
data?: Record<string, unknown> | null;
|
|
16
|
+
}
|
|
17
|
+
/** 校验器所需的最小边结构,可直接接收 ReactFlow Edge。 */
|
|
18
|
+
export interface PortConnectionEdge {
|
|
19
|
+
id?: string;
|
|
20
|
+
source: string;
|
|
21
|
+
target: string;
|
|
22
|
+
sourceHandle?: string | null;
|
|
23
|
+
targetHandle?: string | null;
|
|
24
|
+
}
|
|
25
|
+
export interface PortConnectionValidationOptions {
|
|
26
|
+
/**
|
|
27
|
+
* 显式兼容旧 CLASSIC handle:source `output`、target `input` 映射到 Schema `main`。
|
|
28
|
+
* nodepackage 节点必须保持默认 false,避免把真实的 `input/output/main` 端口混为一谈。
|
|
29
|
+
*/
|
|
30
|
+
allowLegacyMainHandleAliases?: boolean;
|
|
31
|
+
}
|
|
32
|
+
export interface ValidatePortConnectionInput {
|
|
33
|
+
sourceNode?: PortConnectionNode | null;
|
|
34
|
+
targetNode?: PortConnectionNode | null;
|
|
35
|
+
sourceHandle?: string | null;
|
|
36
|
+
targetHandle?: string | null;
|
|
37
|
+
/** 源节点的 output Schema 列表。 */
|
|
38
|
+
sourcePorts?: readonly DipPortSchema[] | null;
|
|
39
|
+
/** 目标节点的 input Schema 列表。 */
|
|
40
|
+
targetPorts?: readonly DipPortSchema[] | null;
|
|
41
|
+
/** 当前画布已有边;新建边本身不应提前加入此列表。 */
|
|
42
|
+
edges?: readonly PortConnectionEdge[] | null;
|
|
43
|
+
options?: PortConnectionValidationOptions;
|
|
44
|
+
}
|
|
45
|
+
export type PortConnectionValidationCode = 'VALID' | 'SOURCE_NODE_NOT_FOUND' | 'TARGET_NODE_NOT_FOUND' | 'SOURCE_PORT_NOT_FOUND' | 'TARGET_PORT_NOT_FOUND' | 'PORT_TYPE_MISMATCH' | 'SOURCE_NODE_NOT_ALLOWED' | 'TARGET_NODE_NOT_ALLOWED' | 'SOURCE_NODE_DENIED' | 'TARGET_NODE_DENIED' | 'SOURCE_MAX_CONNECTIONS_REACHED' | 'TARGET_MAX_CONNECTIONS_REACHED' | 'SELF_CONNECTION_NOT_ALLOWED';
|
|
46
|
+
export interface PortConnectionValidationResult {
|
|
47
|
+
valid: boolean;
|
|
48
|
+
code: PortConnectionValidationCode;
|
|
49
|
+
/** 可直接用于调试的中文兜底原因;界面层应优先按 code 映射 i18n 文案。 */
|
|
50
|
+
reason: string;
|
|
51
|
+
sourcePort: NormalizedDipPortSchema | null;
|
|
52
|
+
targetPort: NormalizedDipPortSchema | null;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* 将端口运行时默认值和 ACM SNAKE_CASE 响应统一为内部 camelCase,不修改原始对象。
|
|
56
|
+
*/
|
|
57
|
+
export declare const normalizePortSchema: (port: DipPortSchema) => NormalizedDipPortSchema;
|
|
58
|
+
/** 从 ReactFlow 节点 data 中解析用于黑白名单判断的 NodePackage schema key。 */
|
|
59
|
+
export declare const getPortConnectionNodeIdentity: (node?: PortConnectionNode | null) => string | null;
|
|
60
|
+
/**
|
|
61
|
+
* 按 NodePackage PortSchema 校验一条准备创建的连接。
|
|
62
|
+
*
|
|
63
|
+
* 本函数拒绝直接自连,但不校验多节点环路、MCP 等画布专项规则;调用方应按
|
|
64
|
+
* “通用图结构规则 → Schema 规则 → 专项规则”的顺序组合。
|
|
65
|
+
*/
|
|
66
|
+
export declare const validatePortConnection: ({ sourceNode, targetNode, sourceHandle, targetHandle, sourcePorts, targetPorts, edges, options, }: ValidatePortConnectionInput) => PortConnectionValidationResult;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { FormSchema } from '../../../dynamic-form/types/form-schema';
|
|
2
|
+
import { DipNodeSchema } from '../api/dip';
|
|
3
|
+
export declare const SWITCH_NODE_PACKAGE_KEY = "dip.core.flow.switch";
|
|
4
|
+
export interface SwitchNodePackageBranch extends Record<string, unknown> {
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
}
|
|
8
|
+
interface NormalizedSwitchBranches {
|
|
9
|
+
branches: SwitchNodePackageBranch[];
|
|
10
|
+
changed: boolean;
|
|
11
|
+
}
|
|
12
|
+
interface NormalizedSwitchProperties extends NormalizedSwitchBranches {
|
|
13
|
+
properties: Record<string, unknown>;
|
|
14
|
+
}
|
|
15
|
+
/** 判断 NodeSchema 是否为当前 nodepackage Switch 节点。 */
|
|
16
|
+
export declare function isSwitchNodePackageKey(nodeKey: unknown): nodeKey is string;
|
|
17
|
+
/**
|
|
18
|
+
* 从 CLASSIC 画布节点数据中读取 Switch 的实际配置。
|
|
19
|
+
*
|
|
20
|
+
* ACM 历史数据可能把业务参数直接放在 config_schema/properties,也可能再包一层
|
|
21
|
+
* properties/params。读取时兼容这些形态,但始终返回扁平业务参数。
|
|
22
|
+
*/
|
|
23
|
+
export declare function getSwitchNodePackageProperties(data: Record<string, unknown>): Record<string, unknown>;
|
|
24
|
+
/** 修复缺失、重复或后端无法路由的 Switch 分支标识。 */
|
|
25
|
+
export declare function normalizeSwitchNodePackageBranches(value: unknown): NormalizedSwitchBranches;
|
|
26
|
+
/** 将分支修复结果合并回节点业务参数。 */
|
|
27
|
+
export declare function normalizeSwitchNodePackageProperties(value: unknown): NormalizedSwitchProperties;
|
|
28
|
+
/**
|
|
29
|
+
* 用实例 branches 派生 Switch 输出端口。
|
|
30
|
+
*
|
|
31
|
+
* Schema 中第一个非 default 输出作为动态分支模板,连接数和目标节点约束会复制到
|
|
32
|
+
* 每个实例分支;default 端口保持后端原始定义。
|
|
33
|
+
*/
|
|
34
|
+
export declare function resolveSwitchNodePackagePortSchema(schema: DipNodeSchema, branches: SwitchNodePackageBranch[]): Pick<DipNodeSchema, 'inputs' | 'outputs'>;
|
|
35
|
+
/** 将节点实例中的 branches 应用到完整 Switch NodeSchema。 */
|
|
36
|
+
export declare function resolveSwitchNodePackageInstanceSchema(schema: DipNodeSchema, data: Record<string, unknown>): DipNodeSchema;
|
|
37
|
+
/**
|
|
38
|
+
* 为 Switch 的 branches ARRAY_OBJECT 注入节点专用的新增项工厂。
|
|
39
|
+
*
|
|
40
|
+
* DynamicForm 仍保持通用;唯一 ID、默认分支名和最小条件结构由 Switch 自己负责。
|
|
41
|
+
*/
|
|
42
|
+
export declare function enhanceSwitchNodePackageFormSchema(schema: FormSchema, nodeKey: unknown): FormSchema;
|
|
43
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { EngineMode } from '../enums/workflow';
|
|
2
|
+
import { EdgeConfig, EdgeRulesConfig, NodeSelectorConnectableConfig } from '../types/engine';
|
|
3
|
+
import { Edge, IsValidConnection, Node } from '@xyflow/react';
|
|
4
|
+
interface ValidateWorkflowConnectionInput {
|
|
5
|
+
edge: EdgeConfig;
|
|
6
|
+
nodes: Node[];
|
|
7
|
+
edges: Edge[];
|
|
8
|
+
engineMode?: EngineMode;
|
|
9
|
+
connectable?: Pick<NodeSelectorConnectableConfig, 'enabled' | 'debug'>;
|
|
10
|
+
validators?: EdgeRulesConfig['validators'];
|
|
11
|
+
nativeIsValidConnection?: IsValidConnection;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* 校验一条准备创建的画布连接。
|
|
15
|
+
*
|
|
16
|
+
* 手动拖线与程序化新增都传入各自的节点/边快照,从而复用 NodePackage、MCP、
|
|
17
|
+
* 宿主 edgeRules 和 ReactFlow native validator。边中插入可由调用方先从快照移除旧边。
|
|
18
|
+
*/
|
|
19
|
+
export declare function validateWorkflowConnection({ edge, nodes, edges, engineMode, connectable, validators, nativeIsValidConnection, }: ValidateWorkflowConnectionInput): boolean;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -8,9 +8,15 @@ import * as React from 'react';
|
|
|
8
8
|
export type PresetTheme = 'default' | 'apple' | 'google' | 'preline';
|
|
9
9
|
export type DynamicFormProps<T = Record<string, unknown>> = {
|
|
10
10
|
schema: FormSchema;
|
|
11
|
+
/** 是否禁用整个动态表单 */
|
|
12
|
+
disabled?: boolean;
|
|
11
13
|
initialValues?: Partial<T>;
|
|
12
14
|
onSubmit?: (values: T) => void | Promise<void>;
|
|
13
15
|
onChange?: (changedValues: Partial<T>, allValues: T) => void;
|
|
16
|
+
/**
|
|
17
|
+
* 观察表单的完整值变化,包括 setFieldValue 等不会触发 onValuesChange 的程序化更新。
|
|
18
|
+
*/
|
|
19
|
+
onValuesObserved?: (allValues: T) => void;
|
|
14
20
|
submitLabel?: string;
|
|
15
21
|
showReset?: boolean;
|
|
16
22
|
resetLabel?: string;
|
|
@@ -54,4 +60,4 @@ export type DynamicFormProps<T = Record<string, unknown>> = {
|
|
|
54
60
|
/** 是否启用事件系统调试日志(默认 false) */
|
|
55
61
|
debugEvents?: boolean;
|
|
56
62
|
};
|
|
57
|
-
export declare function DynamicForm<T extends Record<string, unknown>>({ schema, initialValues, onSubmit, onChange, submitLabel, showReset, resetLabel, onReset, form: externalForm, showSubmit, optionsLoader, nodeId, mcpMode, validateVariable, renderVariableTag, renderVariableTooltip, availableVariables, theme, customTheme, locale, prefixCls, events, customHandlers, maxExecutionDepth, debugEvents, }: DynamicFormProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
63
|
+
export declare function DynamicForm<T extends Record<string, unknown>>({ schema, disabled: disabledProp, initialValues, onSubmit, onChange, onValuesObserved, submitLabel, showReset, resetLabel, onReset, form: externalForm, showSubmit, optionsLoader, nodeId, mcpMode, validateVariable, renderVariableTag, renderVariableTooltip, availableVariables, theme, customTheme, locale, prefixCls, events, customHandlers, maxExecutionDepth, debugEvents, }: DynamicFormProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,14 +1,26 @@
|
|
|
1
|
+
import { ValueModePolicy } from '../../types/form-schema';
|
|
1
2
|
import * as React from 'react';
|
|
2
3
|
export type ValueMode = 'normal' | 'expression' | 'code';
|
|
4
|
+
export declare function getValueModePolicyConfig(policy: ValueModePolicy): {
|
|
5
|
+
availableModes: ValueMode[];
|
|
6
|
+
defaultMode: ValueMode;
|
|
7
|
+
};
|
|
3
8
|
export declare function isEncodedExpressionValue(value: unknown): value is string;
|
|
4
|
-
|
|
5
|
-
|
|
9
|
+
/**
|
|
10
|
+
* 将节点配置中的历史值统一转换为输入组件可消费的字符串。
|
|
11
|
+
* 后端 Schema 允许配置值保留 number/boolean/object,不能依赖 TypeScript 类型断言。
|
|
12
|
+
*/
|
|
13
|
+
export declare function normalizeValueModeInput(value: unknown): string;
|
|
14
|
+
export declare function encodeValueForMode(inputValue: unknown, mode: ValueMode, encodeExpressionValue: boolean): string;
|
|
15
|
+
export declare function decodeValueForMode(value: unknown, mode: ValueMode, encodeExpressionValue: boolean): string;
|
|
6
16
|
export declare function inferValueModeFromValue(value: unknown, defaultMode: ValueMode, encodeExpressionValue: boolean, availableModes?: ValueMode[]): ValueMode;
|
|
7
17
|
export interface ValueModeWrapperProps {
|
|
8
18
|
/** 当前值 */
|
|
9
|
-
value?:
|
|
19
|
+
value?: unknown;
|
|
10
20
|
/** 值变化回调 */
|
|
11
21
|
onChange?: (value: string) => void;
|
|
22
|
+
/** 文本/表达式输入策略 */
|
|
23
|
+
valueModePolicy?: ValueModePolicy;
|
|
12
24
|
/** 可用的模式列表,默认全部可用 */
|
|
13
25
|
availableModes?: ValueMode[];
|
|
14
26
|
/** 初始模式 */
|
|
@@ -51,6 +63,14 @@ export interface ValueModeWrapperProps {
|
|
|
51
63
|
readOnly?: boolean;
|
|
52
64
|
placeholder?: string;
|
|
53
65
|
}) => React.ReactNode;
|
|
66
|
+
/** 自定义渲染表达式模式的组件 */
|
|
67
|
+
renderExpressionMode?: (props: {
|
|
68
|
+
value?: string;
|
|
69
|
+
onChange?: (value: string) => void;
|
|
70
|
+
disabled?: boolean;
|
|
71
|
+
readOnly?: boolean;
|
|
72
|
+
placeholder?: string;
|
|
73
|
+
}) => React.ReactNode;
|
|
54
74
|
/** 普通模式下要渲染的子组件(会通过 cloneElement 传递 value/onChange) */
|
|
55
75
|
children?: React.ReactElement<any>;
|
|
56
76
|
/** 隐藏模式切换器 */
|
|
@@ -5,7 +5,7 @@ import type * as React from 'react';
|
|
|
5
5
|
* 创建标准字段组件定义
|
|
6
6
|
*
|
|
7
7
|
* 这是一个工厂函数,用于将原始组件包装为标准的字段组件定义。
|
|
8
|
-
* 它会根据组件的元数据自动处理
|
|
8
|
+
* 它会根据组件的元数据自动处理 valueModePolicy 和 aiFillable 的包装逻辑。
|
|
9
9
|
*
|
|
10
10
|
* @param Component - 原始字段组件
|
|
11
11
|
* @param meta - 组件元数据
|
|
@@ -17,13 +17,13 @@ import type * as React from 'react';
|
|
|
17
17
|
* }
|
|
18
18
|
*
|
|
19
19
|
* export const TextField = createFieldComponent(TextFieldControl, {
|
|
20
|
-
* supportsVariableInsert: false, // 由 HOC 处理
|
|
20
|
+
* supportsVariableInsert: false, // 由 HOC 处理 valueModePolicy
|
|
21
21
|
* })
|
|
22
22
|
*
|
|
23
23
|
* @example
|
|
24
|
-
* // 组件内部已处理
|
|
24
|
+
* // 组件内部已处理 valueModePolicy
|
|
25
25
|
* const TextFieldControl: React.FC<FieldComponentProps> = ({ field, disabled, readOnly, context }) => {
|
|
26
|
-
* if (field.
|
|
26
|
+
* if (field.valueModePolicy) {
|
|
27
27
|
* return (
|
|
28
28
|
* <ValueModeWrapper validateVariable={context.validateVariable} ...>
|
|
29
29
|
* <Input />
|
|
@@ -73,7 +73,7 @@ export interface FieldComponentProps<T extends FieldDef = FieldDef, K = unknown>
|
|
|
73
73
|
*/
|
|
74
74
|
export interface FieldComponentMeta {
|
|
75
75
|
/**
|
|
76
|
-
*
|
|
76
|
+
* 组件内部是否已处理值模式策略和变量输入特性
|
|
77
77
|
* 如果为 true,FieldRenderer 不会额外包装 ValueModeWrapper
|
|
78
78
|
*/
|
|
79
79
|
supportsVariableInsert?: boolean;
|
|
@@ -7,6 +7,8 @@ export type Option = {
|
|
|
7
7
|
children?: Option[];
|
|
8
8
|
};
|
|
9
9
|
export type ValueMode = 'string' | 'jsExpr' | 'code' | 'variable';
|
|
10
|
+
/** 字段值输入策略 */
|
|
11
|
+
export type ValueModePolicy = 'TEXT' | 'EXPRESSION' | 'BOTH';
|
|
10
12
|
export type OptionsSource = {
|
|
11
13
|
kind: 'static';
|
|
12
14
|
items: Option[];
|
|
@@ -59,6 +61,8 @@ export declare enum DynamicFormField {
|
|
|
59
61
|
LABEL = "LABEL",// 纯文本展示
|
|
60
62
|
HIDDEN = "HIDDEN",// 隐藏字段
|
|
61
63
|
JSON = "JSON",// JSON 编辑器
|
|
64
|
+
CODE = "CODE",// 工作流代码/JSON 编辑器(由宿主作用域注册)
|
|
65
|
+
PROXY = "PROXY",// 工作流代理网关选择器(由宿主作用域注册)
|
|
62
66
|
DIVIDER = "DIVIDER",// 分割线
|
|
63
67
|
INFO_CARD = "INFO_CARD",// 展示卡片
|
|
64
68
|
ARRAY = "ARRAY",// 简单数组
|
|
@@ -78,7 +82,7 @@ export type BaseField = {
|
|
|
78
82
|
helpText?: string;
|
|
79
83
|
readOnly?: boolean | ConditionNode;
|
|
80
84
|
aiFillable?: boolean;
|
|
81
|
-
|
|
85
|
+
valueModePolicy?: ValueModePolicy;
|
|
82
86
|
disabled?: boolean | ConditionNode;
|
|
83
87
|
required?: boolean | ConditionNode;
|
|
84
88
|
visibleWhen?: VisibleWhen;
|
|
@@ -285,6 +289,11 @@ export type ArrayObjectField = BaseField & {
|
|
|
285
289
|
backgroundColor?: string;
|
|
286
290
|
/** 多层 ARRAY_OBJECT 背景色列表。嵌套层会按深度自动取色。 */
|
|
287
291
|
levelBackgroundColors?: string[];
|
|
292
|
+
/** 新增数组项时创建初始对象;用于需要唯一标识或业务默认结构的字段。 */
|
|
293
|
+
createItem?: (context: {
|
|
294
|
+
index: number;
|
|
295
|
+
items: Record<string, unknown>[];
|
|
296
|
+
}) => Record<string, unknown>;
|
|
288
297
|
};
|
|
289
298
|
/** 字段定义联合类型 */
|
|
290
299
|
export type FieldDef = BaseField | TextareaField | SelectField | RadioField | CheckboxGroupField | DateField | DateRangeField | TimeField | TimeRangeField | NumberField | UploadField | SliderField | RateField | CascaderField | TreeSelectField | AutoCompleteField | SwitchField | InfoCardField | ArrayField | ObjectField | KeyValueField | ArrayObjectField;
|