scada-engine 1.0.0
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/LICENSE +21 -0
- package/README.md +193 -0
- package/dist/draco/gltf/draco_decoder.js +33 -0
- package/dist/draco/gltf/draco_decoder.wasm +0 -0
- package/dist/draco/gltf/draco_encoder.js +33 -0
- package/dist/draco/gltf/draco_wasm_wrapper.js +116 -0
- package/dist/index.d.ts +3 -0
- package/dist/scada-engine.css +1 -0
- package/dist/scada-engine.es.js +22936 -0
- package/dist/scada-engine.umd.js +1356 -0
- package/dist/src/features/canvas/components/CanvasArea.d.ts +4 -0
- package/dist/src/features/canvas/components/CanvasConfigPanel.d.ts +2 -0
- package/dist/src/features/canvas/index.d.ts +9 -0
- package/dist/src/features/canvas/managers/configWatcher.d.ts +49 -0
- package/dist/src/features/canvas/managers/dataHandler.d.ts +70 -0
- package/dist/src/features/canvas/managers/layerManager.d.ts +88 -0
- package/dist/src/features/canvas/operations/edgeOperations.d.ts +52 -0
- package/dist/src/features/canvas/operations/graphOperations.d.ts +85 -0
- package/dist/src/features/canvas/operations/nodeOperations.d.ts +77 -0
- package/dist/src/features/data-source/components/DataSourceDialog.d.ts +26 -0
- package/dist/src/features/data-source/components/MappingConfigurator.d.ts +27 -0
- package/dist/src/features/data-source/index.d.ts +14 -0
- package/dist/src/features/data-source/services/dataBindingService.d.ts +86 -0
- package/dist/src/features/data-source/services/dataParser.d.ts +110 -0
- package/dist/src/features/data-source/services/dataSourceManager.d.ts +127 -0
- package/dist/src/features/data-source/services/httpService.d.ts +73 -0
- package/dist/src/features/data-source/services/mqttService.d.ts +110 -0
- package/dist/src/features/data-source/services/sseService.d.ts +75 -0
- package/dist/src/features/data-source/services/websocketService.d.ts +67 -0
- package/dist/src/features/data-source/types/dataAdapter.d.ts +184 -0
- package/dist/src/features/data-source/types/device.d.ts +131 -0
- package/dist/src/features/preview/Preview.d.ts +2 -0
- package/dist/src/features/preview/components/NodeTooltip.d.ts +62 -0
- package/dist/src/features/preview/index.d.ts +1 -0
- package/dist/src/features/property-panel/PropertyPanel.d.ts +45 -0
- package/dist/src/features/property-panel/cards/BindingCard.d.ts +39 -0
- package/dist/src/features/property-panel/cards/EventCard.d.ts +63 -0
- package/dist/src/features/property-panel/index.d.ts +6 -0
- package/dist/src/features/property-panel/tabs/BasicPropertiesTab.d.ts +51 -0
- package/dist/src/features/property-panel/tabs/DataPropertiesTab.d.ts +24 -0
- package/dist/src/features/property-panel/tabs/EdgePropertiesTab.d.ts +22 -0
- package/dist/src/features/workflow/WorkflowDialog.d.ts +37 -0
- package/dist/src/features/workflow/WorkflowEditor.d.ts +38 -0
- package/dist/src/features/workflow/components/AddNodeMenu.d.ts +32 -0
- package/dist/src/features/workflow/components/ElementSelector.d.ts +37 -0
- package/dist/src/features/workflow/components/PropertyPanel.d.ts +27 -0
- package/dist/src/features/workflow/components/WorkflowToolbar.d.ts +24 -0
- package/dist/src/features/workflow/components/node-configs/ClearTimerConfig.d.ts +20 -0
- package/dist/src/features/workflow/components/node-configs/ConditionConfig.d.ts +20 -0
- package/dist/src/features/workflow/components/node-configs/CustomCodeConfig.d.ts +20 -0
- package/dist/src/features/workflow/components/node-configs/GetPropertyConfig.d.ts +20 -0
- package/dist/src/features/workflow/components/node-configs/HttpRequestConfig.d.ts +20 -0
- package/dist/src/features/workflow/components/node-configs/SetPropertyConfig.d.ts +20 -0
- package/dist/src/features/workflow/components/node-configs/TimerConfig.d.ts +20 -0
- package/dist/src/features/workflow/config/nodeConfigRegistry.d.ts +5 -0
- package/dist/src/features/workflow/index.d.ts +6 -0
- package/dist/src/features/workflow/services/canvasElementService.d.ts +31 -0
- package/dist/src/features/workflow/types/element.d.ts +16 -0
- package/dist/src/features/workflow/types/node.d.ts +70 -0
- package/dist/src/index.d.ts +161 -0
- package/dist/src/main.d.ts +1 -0
- package/dist/src/scada-components/canvas/config.d.ts +17 -0
- package/dist/src/scada-components/canvas/index.d.ts +6 -0
- package/dist/src/scada-components/canvas/manager.d.ts +95 -0
- package/dist/src/scada-components/canvas/types.d.ts +77 -0
- package/dist/src/scada-components/chart/echarts-gauge/EChartsGauge.d.ts +14 -0
- package/dist/src/scada-components/chart/echarts-gauge/index.d.ts +6 -0
- package/dist/src/scada-components/chart/echarts-gauge/presets.d.ts +18 -0
- package/dist/src/scada-components/chart/echarts-line/EChartsLine.d.ts +14 -0
- package/dist/src/scada-components/chart/echarts-line/index.d.ts +6 -0
- package/dist/src/scada-components/chart/echarts-line/presets.d.ts +13 -0
- package/dist/src/scada-components/chart/index.d.ts +5 -0
- package/dist/src/scada-components/index.d.ts +7 -0
- package/dist/src/scada-components/registry.d.ts +117 -0
- package/dist/src/scada-components/types.d.ts +108 -0
- package/dist/src/shared/animation/animationEngine.d.ts +68 -0
- package/dist/src/shared/animation/animationScheduler.d.ts +85 -0
- package/dist/src/shared/animation/index.d.ts +2 -0
- package/dist/src/shared/components/ComponentLibrary.d.ts +34 -0
- package/dist/src/shared/components/ContextMenu.d.ts +63 -0
- package/dist/src/shared/components/Footer.d.ts +41 -0
- package/dist/src/shared/components/Header.d.ts +73 -0
- package/dist/src/shared/components/dialogs/AttributeConfigDialog.d.ts +39 -0
- package/dist/src/shared/components/dialogs/CustomCodeDialog.d.ts +30 -0
- package/dist/src/shared/components/dialogs/WorkflowSelectorDialog.d.ts +15 -0
- package/dist/src/shared/components/index.d.ts +8 -0
- package/dist/src/shared/components/selectors/ComponentPointSelector.d.ts +29 -0
- package/dist/src/shared/managers/contextMenuManager.d.ts +27 -0
- package/dist/src/shared/managers/eventManager.d.ts +62 -0
- package/dist/src/shared/managers/index.d.ts +3 -0
- package/dist/src/shared/managers/workerManager.d.ts +57 -0
- package/dist/src/shared/types/binding.d.ts +75 -0
- package/dist/src/shared/types/index.d.ts +2 -0
- package/dist/src/shared/types/workflow.d.ts +195 -0
- package/dist/src/shared/utils/commonUtils.d.ts +83 -0
- package/dist/src/shared/utils/edgeAnimationUtils.d.ts +16 -0
- package/dist/src/shared/utils/eventUtils.d.ts +43 -0
- package/dist/src/shared/utils/fileUtils.d.ts +43 -0
- package/dist/src/shared/utils/index.d.ts +7 -0
- package/dist/src/shared/utils/messageUtils.d.ts +56 -0
- package/dist/src/shared/utils/nodePropertyUtils.d.ts +33 -0
- package/dist/src/shared/utils/storageUtils.d.ts +32 -0
- package/dist/src/svg/core/index.d.ts +7 -0
- package/dist/src/svg/core/loader.d.ts +71 -0
- package/dist/src/svg/core/parser.d.ts +41 -0
- package/dist/src/svg/core/types.d.ts +297 -0
- package/dist/src/svg/helpers/demo.d.ts +20 -0
- package/dist/src/svg/helpers/index.d.ts +5 -0
- package/dist/src/svg/helpers/utils.d.ts +25 -0
- package/dist/src/svg/index.d.ts +9 -0
- package/dist/src/svg/rendering/SVGRenderer.d.ts +22 -0
- package/dist/src/svg/rendering/animationTemplates.d.ts +82 -0
- package/dist/src/svg/rendering/index.d.ts +6 -0
- package/dist/src/utils/authCrypto.d.ts +16 -0
- package/dist/src/utils/dracoLoader.d.ts +3 -0
- package/dist/src/utils/index.d.ts +29 -0
- package/dist/src/utils/viewportCulling.d.ts +63 -0
- package/dist/src/workers/dataProcessor.worker.d.ts +21 -0
- package/dist/utils-Ncgt7Dqu.js +1057 -0
- package/package.json +85 -0
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 流程编排相关类型定义
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* 流程节点类型
|
|
6
|
+
*/
|
|
7
|
+
export declare enum WorkflowNodeType {
|
|
8
|
+
START = "start",// 开始节点
|
|
9
|
+
END = "end",// 结束节点
|
|
10
|
+
CONDITION = "condition",// 条件判断
|
|
11
|
+
ACTION = "action",// 执行动作
|
|
12
|
+
DELAY = "delay",// 延时节点
|
|
13
|
+
LOOP = "loop",// 循环节点
|
|
14
|
+
PARALLEL = "parallel",// 并行节点
|
|
15
|
+
MERGE = "merge"
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* 条件运算符
|
|
19
|
+
*/
|
|
20
|
+
export declare enum ConditionOperator {
|
|
21
|
+
EQUAL = "==",// 等于
|
|
22
|
+
NOT_EQUAL = "!=",// 不等于
|
|
23
|
+
GREATER = ">",// 大于
|
|
24
|
+
GREATER_EQUAL = ">=",// 大于等于
|
|
25
|
+
LESS = "<",// 小于
|
|
26
|
+
LESS_EQUAL = "<=",// 小于等于
|
|
27
|
+
CONTAINS = "contains",// 包含
|
|
28
|
+
NOT_CONTAINS = "not_contains"
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* 动作类型
|
|
32
|
+
*/
|
|
33
|
+
export declare enum ActionType {
|
|
34
|
+
SET_POINT = "setPoint",// 设置点位值
|
|
35
|
+
TRIGGER_EVENT = "triggerEvent",// 触发事件
|
|
36
|
+
SEND_ALARM = "sendAlarm",// 发送告警
|
|
37
|
+
CALL_API = "callApi",// 调用API
|
|
38
|
+
EXECUTE_SCRIPT = "executeScript"
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* 条件配置
|
|
42
|
+
*/
|
|
43
|
+
export interface ConditionConfig {
|
|
44
|
+
/** 左操作数(设备点位ID或变量) */
|
|
45
|
+
leftOperand: string;
|
|
46
|
+
/** 运算符 */
|
|
47
|
+
operator: ConditionOperator;
|
|
48
|
+
/** 右操作数(值或设备点位ID) */
|
|
49
|
+
rightOperand: string | number | boolean;
|
|
50
|
+
/** 逻辑关系(用于多条件组合) */
|
|
51
|
+
logic?: 'AND' | 'OR';
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* 动作配置
|
|
55
|
+
*/
|
|
56
|
+
export interface ActionConfig {
|
|
57
|
+
/** 动作类型 */
|
|
58
|
+
type: ActionType;
|
|
59
|
+
/** 目标设备点位ID */
|
|
60
|
+
targetPointId?: string;
|
|
61
|
+
/** 设置的值 */
|
|
62
|
+
value?: any;
|
|
63
|
+
/** API地址 */
|
|
64
|
+
apiUrl?: string;
|
|
65
|
+
/** 请求方法 */
|
|
66
|
+
method?: 'GET' | 'POST' | 'PUT' | 'DELETE';
|
|
67
|
+
/** 请求参数 */
|
|
68
|
+
params?: Record<string, any>;
|
|
69
|
+
/** 脚本代码 */
|
|
70
|
+
script?: string;
|
|
71
|
+
/** 告警内容 */
|
|
72
|
+
alarmMessage?: string;
|
|
73
|
+
/** 告警级别 */
|
|
74
|
+
alarmLevel?: 'info' | 'warning' | 'error' | 'critical';
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* 流程节点
|
|
78
|
+
*/
|
|
79
|
+
export interface WorkflowNode {
|
|
80
|
+
/** 节点ID */
|
|
81
|
+
id: string;
|
|
82
|
+
/** 节点类型 */
|
|
83
|
+
type: WorkflowNodeType;
|
|
84
|
+
/** 节点名称 */
|
|
85
|
+
name: string;
|
|
86
|
+
/** 节点描述 */
|
|
87
|
+
description?: string;
|
|
88
|
+
/** 节点位置 */
|
|
89
|
+
position: {
|
|
90
|
+
x: number;
|
|
91
|
+
y: number;
|
|
92
|
+
};
|
|
93
|
+
/** 条件配置(条件节点) */
|
|
94
|
+
conditions?: ConditionConfig[];
|
|
95
|
+
/** 动作配置(动作节点) */
|
|
96
|
+
actions?: ActionConfig[];
|
|
97
|
+
/** 延时时间(延时节点,单位:毫秒) */
|
|
98
|
+
delay?: number;
|
|
99
|
+
/** 循环次数(循环节点) */
|
|
100
|
+
loopCount?: number;
|
|
101
|
+
/** 循环条件(循环节点) */
|
|
102
|
+
loopCondition?: ConditionConfig;
|
|
103
|
+
/** 是否启用 */
|
|
104
|
+
enabled?: boolean;
|
|
105
|
+
/** 自定义数据 */
|
|
106
|
+
data?: Record<string, any>;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* 流程连线
|
|
110
|
+
*/
|
|
111
|
+
export interface WorkflowEdge {
|
|
112
|
+
/** 连线ID */
|
|
113
|
+
id: string;
|
|
114
|
+
/** 源节点ID */
|
|
115
|
+
source: string;
|
|
116
|
+
/** 目标节点ID */
|
|
117
|
+
target: string;
|
|
118
|
+
/** 源节点输出端口 */
|
|
119
|
+
sourceHandle?: string;
|
|
120
|
+
/** 目标节点输入端口 */
|
|
121
|
+
targetHandle?: string;
|
|
122
|
+
/** 连线标签(如:true/false分支) */
|
|
123
|
+
label?: string;
|
|
124
|
+
/** 连线类型 */
|
|
125
|
+
type?: 'default' | 'success' | 'fail' | 'always';
|
|
126
|
+
/** 是否启用 */
|
|
127
|
+
enabled?: boolean;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* 流程配置
|
|
131
|
+
*/
|
|
132
|
+
export interface WorkflowConfig {
|
|
133
|
+
/** 流程ID */
|
|
134
|
+
id: string;
|
|
135
|
+
/** 流程名称 */
|
|
136
|
+
name: string;
|
|
137
|
+
/** 流程描述 */
|
|
138
|
+
description?: string;
|
|
139
|
+
/** 流程节点列表 */
|
|
140
|
+
nodes: WorkflowNode[];
|
|
141
|
+
/** 流程连线列表 */
|
|
142
|
+
edges: WorkflowEdge[];
|
|
143
|
+
/** 是否启用 */
|
|
144
|
+
enabled?: boolean;
|
|
145
|
+
/** 触发方式 */
|
|
146
|
+
trigger?: {
|
|
147
|
+
/** 触发类型(manual手动、schedule定时、event事件) */
|
|
148
|
+
type: 'manual' | 'schedule' | 'event';
|
|
149
|
+
/** 定时表达式(cron) */
|
|
150
|
+
cron?: string;
|
|
151
|
+
/** 事件源(设备点位ID) */
|
|
152
|
+
eventSource?: string;
|
|
153
|
+
/** 事件条件 */
|
|
154
|
+
eventCondition?: ConditionConfig;
|
|
155
|
+
};
|
|
156
|
+
/** 创建时间 */
|
|
157
|
+
createTime?: string;
|
|
158
|
+
/** 更新时间 */
|
|
159
|
+
updateTime?: string;
|
|
160
|
+
/** 创建者 */
|
|
161
|
+
creator?: string;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* 流程执行记录
|
|
165
|
+
*/
|
|
166
|
+
export interface WorkflowExecutionLog {
|
|
167
|
+
/** 执行ID */
|
|
168
|
+
id: string;
|
|
169
|
+
/** 流程ID */
|
|
170
|
+
workflowId: string;
|
|
171
|
+
/** 流程名称 */
|
|
172
|
+
workflowName: string;
|
|
173
|
+
/** 开始时间 */
|
|
174
|
+
startTime: string;
|
|
175
|
+
/** 结束时间 */
|
|
176
|
+
endTime?: string;
|
|
177
|
+
/** 执行状态 */
|
|
178
|
+
status: 'running' | 'success' | 'failed' | 'cancelled';
|
|
179
|
+
/** 当前执行节点ID */
|
|
180
|
+
currentNodeId?: string;
|
|
181
|
+
/** 执行结果 */
|
|
182
|
+
result?: any;
|
|
183
|
+
/** 错误信息 */
|
|
184
|
+
error?: string;
|
|
185
|
+
/** 节点执行详情 */
|
|
186
|
+
nodeExecutions?: {
|
|
187
|
+
nodeId: string;
|
|
188
|
+
nodeName: string;
|
|
189
|
+
startTime: string;
|
|
190
|
+
endTime?: string;
|
|
191
|
+
status: 'success' | 'failed' | 'skipped';
|
|
192
|
+
result?: any;
|
|
193
|
+
error?: string;
|
|
194
|
+
}[];
|
|
195
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 通用工具函数
|
|
3
|
+
* 包含ID生成、消息提示等常用功能
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* 生成唯一ID
|
|
7
|
+
* @param prefix 前缀,默认为空
|
|
8
|
+
* @returns 唯一ID字符串
|
|
9
|
+
*/
|
|
10
|
+
export declare const generateUniqueId: (prefix?: string) => string;
|
|
11
|
+
/**
|
|
12
|
+
* 生成事件ID
|
|
13
|
+
* @returns 事件ID
|
|
14
|
+
*/
|
|
15
|
+
export declare const generateEventId: () => string;
|
|
16
|
+
/**
|
|
17
|
+
* 生成节点ID
|
|
18
|
+
* @returns 节点ID
|
|
19
|
+
*/
|
|
20
|
+
export declare const generateNodeId: () => string;
|
|
21
|
+
/**
|
|
22
|
+
* 防抖函数
|
|
23
|
+
* @param func 要执行的函数
|
|
24
|
+
* @param wait 等待时间(毫秒)
|
|
25
|
+
* @returns 防抖后的函数
|
|
26
|
+
*/
|
|
27
|
+
export declare const debounce: <T extends (...args: any[]) => any>(func: T, wait: number) => ((...args: Parameters<T>) => void);
|
|
28
|
+
/**
|
|
29
|
+
* 节流函数
|
|
30
|
+
* @param func 要执行的函数
|
|
31
|
+
* @param limit 时间限制(毫秒)
|
|
32
|
+
* @returns 节流后的函数
|
|
33
|
+
*/
|
|
34
|
+
export declare const throttle: <T extends (...args: any[]) => any>(func: T, limit: number) => ((...args: Parameters<T>) => void);
|
|
35
|
+
/**
|
|
36
|
+
* 深拷贝对象
|
|
37
|
+
* @param obj 要拷贝的对象
|
|
38
|
+
* @returns 拷贝后的对象
|
|
39
|
+
*/
|
|
40
|
+
export declare const deepClone: <T>(obj: T) => T;
|
|
41
|
+
/**
|
|
42
|
+
* 格式化时间戳
|
|
43
|
+
* @param timestamp 时间戳(毫秒)
|
|
44
|
+
* @param format 格式字符串,默认 'YYYY-MM-DD HH:mm:ss'
|
|
45
|
+
* @returns 格式化后的时间字符串
|
|
46
|
+
*/
|
|
47
|
+
export declare const formatTimestamp: (timestamp: number, format?: string) => string;
|
|
48
|
+
/**
|
|
49
|
+
* 获取当前时间戳
|
|
50
|
+
* @returns 当前时间戳(毫秒)
|
|
51
|
+
*/
|
|
52
|
+
export declare const getCurrentTimestamp: () => number;
|
|
53
|
+
/**
|
|
54
|
+
* 生成随机数
|
|
55
|
+
* @param min 最小值
|
|
56
|
+
* @param max 最大值
|
|
57
|
+
* @returns 随机数
|
|
58
|
+
*/
|
|
59
|
+
export declare const randomNumber: (min: number, max: number) => number;
|
|
60
|
+
/**
|
|
61
|
+
* 生成随机位置
|
|
62
|
+
* @param offsetX X偏移量,默认50
|
|
63
|
+
* @param offsetY Y偏移量,默认50
|
|
64
|
+
* @param rangeX X范围,默认400
|
|
65
|
+
* @param rangeY Y范围,默认300
|
|
66
|
+
* @returns 位置对象 {x, y}
|
|
67
|
+
*/
|
|
68
|
+
export declare const randomPosition: (offsetX?: number, offsetY?: number, rangeX?: number, rangeY?: number) => {
|
|
69
|
+
x: number;
|
|
70
|
+
y: number;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* 判断对象是否为空
|
|
74
|
+
* @param obj 对象
|
|
75
|
+
* @returns 是否为空
|
|
76
|
+
*/
|
|
77
|
+
export declare const isEmpty: (obj: any) => boolean;
|
|
78
|
+
/**
|
|
79
|
+
* 延迟执行
|
|
80
|
+
* @param ms 延迟时间(毫秒)
|
|
81
|
+
* @returns Promise
|
|
82
|
+
*/
|
|
83
|
+
export declare const sleep: (ms: number) => Promise<void>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Edge } from '@antv/x6';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 边动画配置接口
|
|
5
|
+
*/
|
|
6
|
+
export interface EdgeAnimationConfig {
|
|
7
|
+
enabled: boolean;
|
|
8
|
+
duration?: number;
|
|
9
|
+
type?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* 应用边动画
|
|
13
|
+
* @param edge X6 边对象
|
|
14
|
+
* @param animation 动画配置
|
|
15
|
+
*/
|
|
16
|
+
export declare function applyEdgeAnimation(edge: Edge, animation: EdgeAnimationConfig): void;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 事件处理工具函数
|
|
3
|
+
* 用于处理节点事件的条件检查和动作执行
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* 检查事件触发条件
|
|
7
|
+
* @param node X6 节点
|
|
8
|
+
* @param event 事件配置
|
|
9
|
+
* @returns 条件是否满足
|
|
10
|
+
*/
|
|
11
|
+
export declare const checkEventCondition: (node: any, event: any) => boolean;
|
|
12
|
+
/**
|
|
13
|
+
* 执行属性变更动作
|
|
14
|
+
* @param node X6 节点
|
|
15
|
+
* @param params 动作参数
|
|
16
|
+
*/
|
|
17
|
+
export declare const executeAttributeChange: (node: any, params: any) => void;
|
|
18
|
+
/**
|
|
19
|
+
* 执行自定义代码动作
|
|
20
|
+
* @param node X6 节点
|
|
21
|
+
* @param event 事件配置
|
|
22
|
+
* @param params 动作参数
|
|
23
|
+
*/
|
|
24
|
+
export declare const executeCustomCode: (node: any, event: any, params: any) => void;
|
|
25
|
+
/**
|
|
26
|
+
* 执行调用流程动作
|
|
27
|
+
* @param node X6 节点
|
|
28
|
+
* @param event 事件配置
|
|
29
|
+
* @param params 动作参数
|
|
30
|
+
*/
|
|
31
|
+
export declare const executeCallProcess: (node: any, _event: any, params: any) => void;
|
|
32
|
+
/**
|
|
33
|
+
* 执行事件动作
|
|
34
|
+
* @param node X6 节点
|
|
35
|
+
* @param event 事件配置
|
|
36
|
+
*/
|
|
37
|
+
export declare const executeEvent: (node: any, event: any) => void;
|
|
38
|
+
/**
|
|
39
|
+
* 为节点注册事件监听器
|
|
40
|
+
* @param graph X6 Graph 实例
|
|
41
|
+
* @param node X6 节点
|
|
42
|
+
*/
|
|
43
|
+
export declare const registerNodeEvents: (graph: any, node: any) => void;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 文件操作工具函数
|
|
3
|
+
* 用于文件的导入导出、下载等操作
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* 导出数据为 JSON 文件
|
|
7
|
+
* @param data 要导出的数据对象
|
|
8
|
+
* @param filename 文件名(不含扩展名)
|
|
9
|
+
* @returns 是否导出成功
|
|
10
|
+
*/
|
|
11
|
+
export declare const exportToJSON: (data: any, filename: string) => boolean;
|
|
12
|
+
/**
|
|
13
|
+
* 从 JSON 文件导入数据
|
|
14
|
+
* @param file 文件对象
|
|
15
|
+
* @returns Promise,成功返回数据对象,失败返回 null
|
|
16
|
+
*/
|
|
17
|
+
export declare const importFromJSON: <T = any>(file: File) => Promise<T | null>;
|
|
18
|
+
/**
|
|
19
|
+
* 下载文本文件
|
|
20
|
+
* @param content 文本内容
|
|
21
|
+
* @param filename 文件名
|
|
22
|
+
* @param mimeType MIME 类型,默认为 text/plain
|
|
23
|
+
*/
|
|
24
|
+
export declare const downloadTextFile: (content: string, filename: string, mimeType?: string) => void;
|
|
25
|
+
/**
|
|
26
|
+
* 触发文件选择对话框
|
|
27
|
+
* @param accept 接受的文件类型,如 '.json'
|
|
28
|
+
* @param multiple 是否允许多选
|
|
29
|
+
* @returns Promise,返回选中的文件列表
|
|
30
|
+
*/
|
|
31
|
+
export declare const selectFiles: (accept?: string, multiple?: boolean) => Promise<FileList | null>;
|
|
32
|
+
/**
|
|
33
|
+
* 读取文件内容为文本
|
|
34
|
+
* @param file 文件对象
|
|
35
|
+
* @returns Promise,返回文件文本内容
|
|
36
|
+
*/
|
|
37
|
+
export declare const readFileAsText: (file: File) => Promise<string | null>;
|
|
38
|
+
/**
|
|
39
|
+
* 读取文件内容为 Data URL
|
|
40
|
+
* @param file 文件对象
|
|
41
|
+
* @returns Promise,返回 Data URL
|
|
42
|
+
*/
|
|
43
|
+
export declare const readFileAsDataURL: (file: File) => Promise<string | null>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 消息提示工具函数
|
|
3
|
+
* 统一管理消息提示、确认对话框等
|
|
4
|
+
*/
|
|
5
|
+
export type MessageType = 'success' | 'error' | 'warning' | 'info';
|
|
6
|
+
/**
|
|
7
|
+
* 显示提示消息
|
|
8
|
+
* @param message 消息内容
|
|
9
|
+
* @param type 消息类型
|
|
10
|
+
* @param duration 显示时长(毫秒),默认3000
|
|
11
|
+
*/
|
|
12
|
+
export declare const showMessage: (message: string, type?: MessageType, duration?: number) => void;
|
|
13
|
+
/**
|
|
14
|
+
* 显示成功消息
|
|
15
|
+
* @param message 消息内容
|
|
16
|
+
* @param duration 显示时长(毫秒)
|
|
17
|
+
*/
|
|
18
|
+
export declare const showSuccess: (message: string, duration?: number) => void;
|
|
19
|
+
/**
|
|
20
|
+
* 显示错误消息
|
|
21
|
+
* @param message 消息内容
|
|
22
|
+
* @param duration 显示时长(毫秒)
|
|
23
|
+
*/
|
|
24
|
+
export declare const showError: (message: string, duration?: number) => void;
|
|
25
|
+
/**
|
|
26
|
+
* 显示警告消息
|
|
27
|
+
* @param message 消息内容
|
|
28
|
+
* @param duration 显示时长(毫秒)
|
|
29
|
+
*/
|
|
30
|
+
export declare const showWarning: (message: string, duration?: number) => void;
|
|
31
|
+
/**
|
|
32
|
+
* 显示信息消息
|
|
33
|
+
* @param message 消息内容
|
|
34
|
+
* @param duration 显示时长(毫秒)
|
|
35
|
+
*/
|
|
36
|
+
export declare const showInfo: (message: string, duration?: number) => void;
|
|
37
|
+
/**
|
|
38
|
+
* 显示确认对话框
|
|
39
|
+
* @param message 提示消息
|
|
40
|
+
* @param title 对话框标题
|
|
41
|
+
* @returns Promise<boolean> 用户确认返回true,取消返回false
|
|
42
|
+
*/
|
|
43
|
+
export declare const showConfirm: (message: string, title?: string) => Promise<boolean>;
|
|
44
|
+
/**
|
|
45
|
+
* 显示输入对话框
|
|
46
|
+
* @param message 提示消息
|
|
47
|
+
* @param defaultValue 默认值
|
|
48
|
+
* @returns Promise<string | null> 用户输入的值,取消返回null
|
|
49
|
+
*/
|
|
50
|
+
export declare const showPrompt: (message: string, defaultValue?: string) => Promise<string | null>;
|
|
51
|
+
/**
|
|
52
|
+
* 显示加载提示
|
|
53
|
+
* @param message 加载消息
|
|
54
|
+
* @returns 返回关闭函数
|
|
55
|
+
*/
|
|
56
|
+
export declare const showLoading: (message?: string) => (() => void);
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 节点属性操作工具函数
|
|
3
|
+
* 用于处理节点属性的获取、设置等操作
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* 获取嵌套对象的值
|
|
7
|
+
* @param obj 对象
|
|
8
|
+
* @param path 路径,使用.分隔,如 'a.b.c'
|
|
9
|
+
* @returns 属性值
|
|
10
|
+
*/
|
|
11
|
+
export declare const getNestedValue: (obj: any, path: string) => any;
|
|
12
|
+
/**
|
|
13
|
+
* 设置嵌套对象的值
|
|
14
|
+
* @param obj 对象
|
|
15
|
+
* @param path 路径,使用.分隔,如 'a.b.c'
|
|
16
|
+
* @param value 要设置的值
|
|
17
|
+
*/
|
|
18
|
+
export declare const setNestedValue: (obj: any, path: string, value: any) => void;
|
|
19
|
+
/**
|
|
20
|
+
* 根据 props 配置获取节点属性值
|
|
21
|
+
* @param node X6 节点
|
|
22
|
+
* @param propertyKey 属性键(在 props 中定义的 key)
|
|
23
|
+
* @returns 属性值
|
|
24
|
+
*/
|
|
25
|
+
export declare const getNodePropertyValue: (node: any, propertyKey: string) => any;
|
|
26
|
+
/**
|
|
27
|
+
* 根据 props 配置设置节点属性值
|
|
28
|
+
* @param node X6 节点
|
|
29
|
+
* @param propertyKey 属性键(在 props 中定义的 key)
|
|
30
|
+
* @param value 要设置的值
|
|
31
|
+
* @returns 是否设置成功
|
|
32
|
+
*/
|
|
33
|
+
export declare const setNodePropertyValue: (node: any, propertyKey: string, value: any) => boolean;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 存储工具函数
|
|
3
|
+
* 统一使用 localStorage 进行数据持久化
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* LocalStorage 键名常量
|
|
7
|
+
*/
|
|
8
|
+
export declare const STORAGE_KEYS: {
|
|
9
|
+
readonly SCADA_EDITOR_DATA: "scada_editor_data";
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* 保存数据到 localStorage
|
|
13
|
+
* @param key 键名
|
|
14
|
+
* @param data 数据对象
|
|
15
|
+
* @returns 是否保存成功
|
|
16
|
+
*/
|
|
17
|
+
export declare const saveToLocal: <T = any>(key: string, data: T) => boolean;
|
|
18
|
+
/**
|
|
19
|
+
* 从 localStorage 读取数据
|
|
20
|
+
* @param key 键名
|
|
21
|
+
* @returns 数据对象,失败返回 null
|
|
22
|
+
*/
|
|
23
|
+
export declare const loadFromLocal: <T = any>(key: string) => T | null;
|
|
24
|
+
/**
|
|
25
|
+
* 从 localStorage 删除数据
|
|
26
|
+
* @param key 键名
|
|
27
|
+
*/
|
|
28
|
+
export declare const removeFromLocal: (key: string) => void;
|
|
29
|
+
/**
|
|
30
|
+
* 清空 localStorage
|
|
31
|
+
*/
|
|
32
|
+
export declare const clearLocal: () => void;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SVG 组件加载器
|
|
3
|
+
* 负责加载 SVG 文件并注册到组件注册表
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* SVG 组件加载器类
|
|
7
|
+
*/
|
|
8
|
+
export declare class SVGLoader {
|
|
9
|
+
/**
|
|
10
|
+
* 从字符串加载 SVG 组件
|
|
11
|
+
* @param svgContent SVG 文件内容
|
|
12
|
+
* @param fileName 文件名(可选)
|
|
13
|
+
* @returns 是否加载成功
|
|
14
|
+
*/
|
|
15
|
+
loadFromString(svgContent: string, fileName?: string): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* 从文件加载 SVG 组件
|
|
18
|
+
* @param file File 对象
|
|
19
|
+
* @returns Promise<boolean>
|
|
20
|
+
*/
|
|
21
|
+
loadFromFile(file: File): Promise<boolean>;
|
|
22
|
+
/**
|
|
23
|
+
* 批量加载 SVG 组件
|
|
24
|
+
* @param files File 对象数组
|
|
25
|
+
* @returns Promise<加载成功的数量>
|
|
26
|
+
*/
|
|
27
|
+
loadBatch(files: File[]): Promise<number>;
|
|
28
|
+
/**
|
|
29
|
+
* 从 URL 加载 SVG 组件
|
|
30
|
+
* @param url SVG 文件 URL
|
|
31
|
+
* @returns Promise<boolean>
|
|
32
|
+
*/
|
|
33
|
+
loadFromUrl(url: string): Promise<boolean>;
|
|
34
|
+
/**
|
|
35
|
+
* 转换 SVGComponentConfig 为 ComponentConfig
|
|
36
|
+
*/
|
|
37
|
+
private convertToComponentConfig;
|
|
38
|
+
/**
|
|
39
|
+
* 从 presetBindings 生成 InternalAnimations
|
|
40
|
+
*/
|
|
41
|
+
private generateInternalAnimations;
|
|
42
|
+
/**
|
|
43
|
+
* 生成默认的驱动字段值
|
|
44
|
+
*/
|
|
45
|
+
private generateDefaultDriverValues;
|
|
46
|
+
/**
|
|
47
|
+
* 生成接线柱配置
|
|
48
|
+
* 接线柱向组件内侧偏移(dx/dy)使圆心落在组件边界上,避免显示在组件外
|
|
49
|
+
*/
|
|
50
|
+
private generatePorts;
|
|
51
|
+
/**
|
|
52
|
+
* 生成组件属性配置
|
|
53
|
+
* 多个 presetBinding 共享同一 driverProperty 时只生成一个 prop(去重)
|
|
54
|
+
*/
|
|
55
|
+
private generateProps;
|
|
56
|
+
/**
|
|
57
|
+
* 根据数值范围推断合理的 step
|
|
58
|
+
*/
|
|
59
|
+
private inferStep;
|
|
60
|
+
/**
|
|
61
|
+
* 根据 SVG 配置生成组件点位定义
|
|
62
|
+
* 主要用于数据绑定面板中的“组件数据点位”列表
|
|
63
|
+
* 多个 presetBinding 共享同一 driverProperty 时只生成一个点位(去重)
|
|
64
|
+
*/
|
|
65
|
+
private generatePoints;
|
|
66
|
+
/**
|
|
67
|
+
* 读取文件为文本
|
|
68
|
+
*/
|
|
69
|
+
private readFileAsText;
|
|
70
|
+
}
|
|
71
|
+
export declare const svgLoader: SVGLoader;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { SVGComponentConfig } from './types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* SVG 解析器类
|
|
5
|
+
*/
|
|
6
|
+
export declare class SVGParser {
|
|
7
|
+
/**
|
|
8
|
+
* 解析 SVG 字符串
|
|
9
|
+
* @param svgContent SVG 文件内容
|
|
10
|
+
* @param fileName 文件名(可选)
|
|
11
|
+
* @returns 解析后的组件配置
|
|
12
|
+
*/
|
|
13
|
+
static parse(svgContent: string, fileName?: string): SVGComponentConfig | null;
|
|
14
|
+
/**
|
|
15
|
+
* 提取元数据(从 <metadata><scada-config> 中)
|
|
16
|
+
*/
|
|
17
|
+
private static extractMetadata;
|
|
18
|
+
/**
|
|
19
|
+
* 生成默认元数据(当 SVG 没有配置时)
|
|
20
|
+
*/
|
|
21
|
+
private static generateDefaultMetadata;
|
|
22
|
+
/**
|
|
23
|
+
* 提取尺寸信息
|
|
24
|
+
*/
|
|
25
|
+
private static extractSize;
|
|
26
|
+
/**
|
|
27
|
+
* 提取内部部件(自动扫描 id="part-*" 的元素)
|
|
28
|
+
*/
|
|
29
|
+
private static extractParts;
|
|
30
|
+
/**
|
|
31
|
+
* 清理 SVG 内容(移除 metadata 等不需要渲染的标签)
|
|
32
|
+
*/
|
|
33
|
+
private static cleanSvgContent;
|
|
34
|
+
/**
|
|
35
|
+
* 验证 SVG 配置
|
|
36
|
+
*/
|
|
37
|
+
static validate(config: SVGComponentConfig): {
|
|
38
|
+
valid: boolean;
|
|
39
|
+
errors: string[];
|
|
40
|
+
};
|
|
41
|
+
}
|