@nywqs/scada-engine 1.1.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.
Files changed (67) hide show
  1. package/README.md +455 -0
  2. package/dist/components/AttributeConfigDialog.d.ts +39 -0
  3. package/dist/components/BasicPropertiesTab.d.ts +51 -0
  4. package/dist/components/BindingCard.d.ts +36 -0
  5. package/dist/components/CanvasArea.d.ts +4 -0
  6. package/dist/components/CanvasConfigPanel.d.ts +2 -0
  7. package/dist/components/ComponentLibrary.d.ts +6 -0
  8. package/dist/components/CustomCodeDialog.d.ts +30 -0
  9. package/dist/components/DataPropertiesTab.d.ts +42 -0
  10. package/dist/components/DevicePointSelector.d.ts +27 -0
  11. package/dist/components/EdgePropertiesTab.d.ts +22 -0
  12. package/dist/components/EventCard.d.ts +63 -0
  13. package/dist/components/Footer.d.ts +37 -0
  14. package/dist/components/Header.d.ts +71 -0
  15. package/dist/components/MappingConfigurator.d.ts +27 -0
  16. package/dist/components/PropertyPanel.d.ts +27 -0
  17. package/dist/components/WorkflowSelectorDialog.d.ts +15 -0
  18. package/dist/index.d.ts +157 -0
  19. package/dist/main.d.ts +1 -0
  20. package/dist/mock/deviceData.d.ts +39 -0
  21. package/dist/scada-components/basic/circle.d.ts +6 -0
  22. package/dist/scada-components/basic/index.d.ts +6 -0
  23. package/dist/scada-components/basic/rect.d.ts +6 -0
  24. package/dist/scada-components/basic/text.d.ts +6 -0
  25. package/dist/scada-components/canvas/config.d.ts +17 -0
  26. package/dist/scada-components/canvas/index.d.ts +6 -0
  27. package/dist/scada-components/canvas/manager.d.ts +95 -0
  28. package/dist/scada-components/canvas/types.d.ts +77 -0
  29. package/dist/scada-components/index.d.ts +8 -0
  30. package/dist/scada-components/iot/gauge.d.ts +6 -0
  31. package/dist/scada-components/iot/index.d.ts +6 -0
  32. package/dist/scada-components/iot/light.d.ts +6 -0
  33. package/dist/scada-components/iot/switch.d.ts +6 -0
  34. package/dist/scada-components/registry.d.ts +56 -0
  35. package/dist/scada-components/types.d.ts +82 -0
  36. package/dist/scada-engine.css +1 -0
  37. package/dist/scada-engine.es.js +12390 -0
  38. package/dist/scada-engine.umd.js +53 -0
  39. package/dist/types/binding.d.ts +75 -0
  40. package/dist/types/device.d.ts +131 -0
  41. package/dist/types/workflow.d.ts +195 -0
  42. package/dist/utils/animationEngine.d.ts +68 -0
  43. package/dist/utils/authCrypto.d.ts +45 -0
  44. package/dist/utils/commonUtils.d.ts +83 -0
  45. package/dist/utils/eventUtils.d.ts +43 -0
  46. package/dist/utils/fileUtils.d.ts +43 -0
  47. package/dist/utils/index.d.ts +10 -0
  48. package/dist/utils/messageUtils.d.ts +56 -0
  49. package/dist/utils/nodePropertyUtils.d.ts +33 -0
  50. package/dist/utils/storageUtils.d.ts +55 -0
  51. package/dist/views/workflow/WorkflowDialog.d.ts +37 -0
  52. package/dist/views/workflow/WorkflowEditor.d.ts +38 -0
  53. package/dist/views/workflow/components/AddNodeMenu.d.ts +32 -0
  54. package/dist/views/workflow/components/ElementSelector.d.ts +45 -0
  55. package/dist/views/workflow/components/PropertyPanel.d.ts +27 -0
  56. package/dist/views/workflow/components/WorkflowToolbar.d.ts +24 -0
  57. package/dist/views/workflow/components/node-configs/ClearTimerConfig.d.ts +20 -0
  58. package/dist/views/workflow/components/node-configs/ConditionConfig.d.ts +20 -0
  59. package/dist/views/workflow/components/node-configs/CustomCodeConfig.d.ts +20 -0
  60. package/dist/views/workflow/components/node-configs/GetPropertyConfig.d.ts +20 -0
  61. package/dist/views/workflow/components/node-configs/HttpRequestConfig.d.ts +20 -0
  62. package/dist/views/workflow/components/node-configs/SetPropertyConfig.d.ts +20 -0
  63. package/dist/views/workflow/components/node-configs/TimerConfig.d.ts +20 -0
  64. package/dist/views/workflow/config/nodeConfigRegistry.d.ts +5 -0
  65. package/dist/views/workflow/services/canvasElementService.d.ts +31 -0
  66. package/dist/views/workflow/types/node.d.ts +70 -0
  67. package/package.json +77 -0
@@ -0,0 +1,75 @@
1
+ /**
2
+ * 数据绑定和映射配置类型定义
3
+ */
4
+ /**
5
+ * 映射类型
6
+ */
7
+ export declare enum MappingType {
8
+ DIRECT = "direct",// 直接映射
9
+ BOOLEAN = "boolean",// 布尔映射
10
+ RANGE = "range",// 范围映射
11
+ ENUM = "enum"
12
+ }
13
+ /**
14
+ * 值类型(与点位数据类型对应)
15
+ */
16
+ export declare enum ValueType {
17
+ BOOLEAN = "boolean",// 布尔型
18
+ NUMBER = "number",// 数值型
19
+ STRING = "string"
20
+ }
21
+ /**
22
+ * 范围映射规则
23
+ */
24
+ export interface RangeRule {
25
+ /** 最小值(包含) */
26
+ min: number;
27
+ /** 最大值(包含) */
28
+ max: number;
29
+ /** 映射值 */
30
+ value: any;
31
+ /** 标签(可选) */
32
+ label?: string;
33
+ /** 单位(可选) */
34
+ unit?: string;
35
+ }
36
+ /**
37
+ * 映射配置
38
+ */
39
+ export interface MappingConfig {
40
+ /** 映射类型 */
41
+ type: MappingType;
42
+ /** 值类型(必填) */
43
+ valueType: ValueType;
44
+ /** 布尔映射 - true时的值 */
45
+ trueValue?: any;
46
+ /** 布尔映射 - false时的值 */
47
+ falseValue?: any;
48
+ /** 范围映射 - 规则列表 */
49
+ rangeRules?: RangeRule[];
50
+ /** 枚举映射 - 键值对 */
51
+ enumMappings?: Record<string, any>;
52
+ /** 保留原始值的单位(可选) */
53
+ keepOriginalUnit?: boolean;
54
+ /** 自定义单位(可选,会覆盖点位单位) */
55
+ customUnit?: string;
56
+ }
57
+ /**
58
+ * 绑定配置
59
+ */
60
+ export interface BindingConfig {
61
+ /** 绑定ID */
62
+ id?: string;
63
+ /** 设备点位ID(格式: deviceId:pointId) */
64
+ devicePointId?: string;
65
+ /** 目标节点属性 */
66
+ targetProperty?: string;
67
+ /** 映射配置 */
68
+ mapping?: MappingConfig;
69
+ /** 是否启用 */
70
+ enabled?: boolean;
71
+ }
72
+ /**
73
+ * 应用映射规则,将点位值转换为目标值
74
+ */
75
+ export declare function applyMapping(value: any, mapping: MappingConfig): any;
@@ -0,0 +1,131 @@
1
+ /**
2
+ * 设备点位数据结构定义
3
+ */
4
+ /**
5
+ * 点位数据类型
6
+ */
7
+ export declare enum PointDataType {
8
+ BOOLEAN = "boolean",// 布尔值
9
+ NUMBER = "number",// 数值
10
+ STRING = "string"
11
+ }
12
+ /**
13
+ * 点位访问权限
14
+ */
15
+ export declare enum PointAccessMode {
16
+ READ = "read",// 只读
17
+ WRITE = "write",// 只写
18
+ READ_WRITE = "readWrite"
19
+ }
20
+ /**
21
+ * 设备点位
22
+ */
23
+ export interface DevicePoint {
24
+ /** 点位ID */
25
+ id: string;
26
+ /** 点位名称 */
27
+ name: string;
28
+ /** 点位编码(设备内部地址) */
29
+ code: string;
30
+ /** 点位描述 */
31
+ description?: string;
32
+ /** 数据类型 */
33
+ dataType: PointDataType;
34
+ /** 访问权限 */
35
+ accessMode: PointAccessMode;
36
+ /** 当前值 */
37
+ value?: any;
38
+ /** 单位 */
39
+ unit?: string;
40
+ /** 最小值 */
41
+ minValue?: number;
42
+ /** 最大值 */
43
+ maxValue?: number;
44
+ /** 精度(小数位数) */
45
+ precision?: number;
46
+ /** 是否启用 */
47
+ enabled?: boolean;
48
+ /** 更新时间 */
49
+ updateTime?: string;
50
+ /** 质量戳(good/bad/uncertain) */
51
+ quality?: 'good' | 'bad' | 'uncertain';
52
+ }
53
+ /**
54
+ * 设备状态
55
+ */
56
+ export declare enum DeviceStatus {
57
+ ONLINE = "online",// 在线
58
+ OFFLINE = "offline",// 离线
59
+ ERROR = "error",// 故障
60
+ MAINTENANCE = "maintenance"
61
+ }
62
+ /**
63
+ * 设备类型
64
+ */
65
+ export declare enum DeviceType {
66
+ PLC = "plc",// PLC设备
67
+ SENSOR = "sensor",// 传感器
68
+ ACTUATOR = "actuator",// 执行器
69
+ METER = "meter",// 仪表
70
+ CAMERA = "camera",// 摄像头
71
+ OTHER = "other"
72
+ }
73
+ /**
74
+ * 设备
75
+ */
76
+ export interface Device {
77
+ /** 设备ID */
78
+ id: string;
79
+ /** 设备名称 */
80
+ name: string;
81
+ /** 设备编码 */
82
+ code: string;
83
+ /** 设备类型 */
84
+ type: DeviceType;
85
+ /** 设备描述 */
86
+ description?: string;
87
+ /** 设备状态 */
88
+ status: DeviceStatus;
89
+ /** 设备IP地址 */
90
+ ipAddress?: string;
91
+ /** 设备端口 */
92
+ port?: number;
93
+ /** 通信协议 */
94
+ protocol?: string;
95
+ /** 点位列表 */
96
+ points: DevicePoint[];
97
+ /** 是否启用 */
98
+ enabled?: boolean;
99
+ /** 创建时间 */
100
+ createTime?: string;
101
+ /** 更新时间 */
102
+ updateTime?: string;
103
+ /** 标签 */
104
+ tags?: string[];
105
+ /** 扩展属性 */
106
+ properties?: Record<string, any>;
107
+ }
108
+ /**
109
+ * 设备列表
110
+ */
111
+ export interface DeviceList {
112
+ /** 设备列表 */
113
+ devices: Device[];
114
+ /** 总数 */
115
+ total: number;
116
+ }
117
+ /**
118
+ * 点位值更新事件
119
+ */
120
+ export interface PointValueUpdate {
121
+ /** 设备ID */
122
+ deviceId: string;
123
+ /** 点位ID */
124
+ pointId: string;
125
+ /** 新值 */
126
+ value: any;
127
+ /** 更新时间 */
128
+ timestamp: string;
129
+ /** 质量戳 */
130
+ quality: 'good' | 'bad' | 'uncertain';
131
+ }
@@ -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,68 @@
1
+ /**
2
+ * 动画执行引擎
3
+ * 负责处理组件的各种动画效果
4
+ */
5
+ export type AnimationType = 'none' | 'blink' | 'scale' | 'rotate' | 'float' | 'pulse';
6
+ export interface AnimationConfig {
7
+ type: AnimationType;
8
+ duration: number;
9
+ loop: boolean;
10
+ }
11
+ /**
12
+ * 动画管理器
13
+ */
14
+ declare class AnimationEngine {
15
+ animations: Map<string, any>;
16
+ /**
17
+ * 启动节点动画
18
+ * @param node X6 节点
19
+ * @param config 动画配置
20
+ */
21
+ startAnimation(node: any, config: AnimationConfig): void;
22
+ /**
23
+ * 停止节点动画
24
+ * @param nodeId 节点ID
25
+ */
26
+ stopAnimation(nodeId: string): void;
27
+ /**
28
+ * 创建闪烁动画
29
+ */
30
+ createBlinkAnimation(node: any, config: AnimationConfig): {
31
+ intervalId: NodeJS.Timeout;
32
+ stop: () => void;
33
+ };
34
+ /**
35
+ * 创建缩放动画
36
+ */
37
+ createScaleAnimation(node: any, config: AnimationConfig): {
38
+ intervalId: NodeJS.Timeout;
39
+ stop: () => void;
40
+ };
41
+ /**
42
+ * 创建旋转动画
43
+ */
44
+ createRotateAnimation(node: any, config: AnimationConfig): {
45
+ intervalId: NodeJS.Timeout;
46
+ stop: () => void;
47
+ };
48
+ /**
49
+ * 创建浮动动画
50
+ */
51
+ createFloatAnimation(node: any, config: AnimationConfig): {
52
+ intervalId: NodeJS.Timeout;
53
+ stop: () => void;
54
+ };
55
+ /**
56
+ * 创建脉冲动画
57
+ */
58
+ createPulseAnimation(node: any, config: AnimationConfig): {
59
+ intervalId: NodeJS.Timeout;
60
+ stop: () => void;
61
+ };
62
+ /**
63
+ * 清除所有动画
64
+ */
65
+ clearAll(): void;
66
+ }
67
+ export declare const animationEngine: AnimationEngine;
68
+ export {};
@@ -0,0 +1,45 @@
1
+ interface DecryptResult {
2
+ success: boolean;
3
+ company?: string;
4
+ expiryDate?: string;
5
+ machineId?: string;
6
+ parts?: string[];
7
+ error?: string;
8
+ }
9
+ /**
10
+ * 解密授权码
11
+ * @param hexString - Hex格式的授权码
12
+ * @param password - 解密密码
13
+ * @returns 解密结果
14
+ */
15
+ export declare function decryptAuthKey(hexString: string, password?: string): DecryptResult;
16
+ /**
17
+ * 验证授权码有效性
18
+ * @param authCode - Hex格式的授权码
19
+ * @param password - 解密密码
20
+ * @returns 是否有效
21
+ */
22
+ export declare function validateAuthKey(authCode: string, password?: string): boolean;
23
+ /**
24
+ * 获取授权信息
25
+ * @param authCode - Hex格式的授权码
26
+ * @param password - 解密密码
27
+ * @returns 授权信息对象
28
+ */
29
+ export declare function getAuthInfo(authCode: string, password?: string): {
30
+ company: string;
31
+ expiryDate: string | undefined;
32
+ isValid: boolean;
33
+ } | null;
34
+ /**
35
+ * 生成测试授权码的辅助函数
36
+ * 注意:此函数仅用于开发测试,生产环境应使用 Node.js 版本的 authkey_tool.js
37
+ */
38
+ export declare function generateTestAuthCode(company: string, expiryDate?: string): string;
39
+ declare const _default: {
40
+ decryptAuthKey: typeof decryptAuthKey;
41
+ validateAuthKey: typeof validateAuthKey;
42
+ getAuthInfo: typeof getAuthInfo;
43
+ generateTestAuthCode: typeof generateTestAuthCode;
44
+ };
45
+ export default _default;
@@ -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,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,10 @@
1
+ /**
2
+ * 工具函数统一导出
3
+ * 便于其他模块使用
4
+ */
5
+ export * from './nodePropertyUtils';
6
+ export * from './eventUtils';
7
+ export * from './storageUtils';
8
+ export * from './fileUtils';
9
+ export * from './commonUtils';
10
+ export * from './messageUtils';