-
Notifications
You must be signed in to change notification settings - Fork 232
Expand file tree
/
Copy pathvariableAggregationNodeState.jsx
More file actions
56 lines (50 loc) · 1.87 KB
/
variableAggregationNodeState.jsx
File metadata and controls
56 lines (50 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*---------------------------------------------------------------------------------------------
* Copyright (c) 2025 Huawei Technologies Co., Ltd. All rights reserved.
* This file is a part of the ModelEngine Project.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import {DATA_TYPES, DEFAULT_FLOW_META} from '@/common/Consts.js';
import {variableAggregationDrawer} from '@/components/variableAggregation/variableAggregationDrawer.jsx';
import {jadeNode} from '@/components/base/jadeNode.jsx';
/**
* 变量聚合节点.
*
* @override
*/
export const variableAggregationNodeState = (id, x, y, width, height, parent, drawer) => {
const self = jadeNode(id, x, y, width, height, parent, drawer ? drawer : variableAggregationDrawer);
self.type = 'variableAggregationNodeState';
self.text = '变量聚合';
self.componentName = 'variableAggregationComponent';
self.flowMeta = JSON.parse(DEFAULT_FLOW_META);
/**
* 处理传递的元数据
*
* @param metaData 元数据信息
*/
self.processMetaData = (metaData) => {
if (metaData && metaData.name) {
self.text = metaData.name;
}
self.flowMeta.jober.entity.uniqueName = metaData.uniqueName;
};
/**
* 序列化
*
* @override
*/
self.serializerJadeConfig = (jadeConfig) => {
self.flowMeta.jober.converter.entity = jadeConfig;
self.flowMeta.jober.entity.params = self.flowMeta.jober.converter.entity.inputParams.map(property => {
return {name: property.name};
});
self.flowMeta.jober.entity.return.type = self.flowMeta.jober.converter.entity.outputParams[0].type ?? DATA_TYPES.STRING;
};
/**
* @override
*/
self.maxNumToLink = () => {
return self.graph?.connectionLimitDisabled ? 100 : 10;
};
return self;
};