@nywqs/scada-engine 1.1.27 → 1.1.29
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/README.md +28 -13
- package/dist/assets/dataProcessor.worker-DerLDc7p.js +1 -0
- package/dist/scada-engine.css +1 -1
- package/dist/scada-engine.es.js +15236 -13405
- package/dist/scada-engine.umd.js +26 -26
- package/dist/src/components/BindingCard.d.ts +3 -6
- package/dist/src/components/{DevicePointSelector.d.ts → ComponentPointSelector.d.ts} +5 -9
- package/dist/src/components/DataPropertiesTab.d.ts +0 -2
- package/dist/src/scada-components/iot/industrial-3d-fluid.d.ts +9 -0
- package/dist/src/scada-components/registry.d.ts +65 -4
- package/dist/src/scada-components/types.d.ts +28 -3
- package/dist/src/services/dataParser.d.ts +110 -0
- package/dist/src/services/dataSourceManager.d.ts +7 -1
- package/dist/src/services/httpService.d.ts +73 -0
- package/dist/src/services/mqttService.d.ts +5 -5
- package/dist/src/services/sseService.d.ts +75 -0
- package/dist/src/services/websocketService.d.ts +67 -0
- package/dist/src/types/dataAdapter.d.ts +184 -0
- package/dist/src/utils/animationScheduler.d.ts +85 -0
- package/dist/src/utils/canvasLayerManager.d.ts +88 -0
- package/dist/src/utils/dataBindingService.d.ts +55 -11
- package/dist/src/utils/index.d.ts +4 -0
- package/dist/src/utils/nodeOperations.d.ts +1 -1
- package/dist/src/utils/viewportCulling.d.ts +63 -0
- package/dist/src/utils/workerManager.d.ts +57 -0
- package/dist/src/views/workflow/components/ElementSelector.d.ts +2 -10
- package/dist/src/views/workflow/components/WorkflowToolbar.d.ts +1 -1
- package/dist/src/views/workflow/services/canvasElementService.d.ts +4 -4
- package/dist/src/views/workflow/types/element.d.ts +16 -0
- package/dist/src/workers/dataProcessor.worker.d.ts +21 -0
- package/package.json +1 -1
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 组件数据适配器类型定义
|
|
3
|
+
* 负责将原始数据转换为组件需要的格式
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* 数据提取器函数类型
|
|
7
|
+
* 用于从原始数据中提取需要的值
|
|
8
|
+
*/
|
|
9
|
+
export type DataExtractor = (rawData: any) => any;
|
|
10
|
+
/**
|
|
11
|
+
* 数据转换器函数类型
|
|
12
|
+
* 用于将提取的数据转换为组件需要的格式
|
|
13
|
+
*/
|
|
14
|
+
export type DataTransformer = (value: any, componentConfig?: any) => any;
|
|
15
|
+
/**
|
|
16
|
+
* 数据验证器函数类型
|
|
17
|
+
* 用于验证数据格式是否符合组件要求
|
|
18
|
+
*/
|
|
19
|
+
export type DataValidator = (value: any) => boolean;
|
|
20
|
+
/**
|
|
21
|
+
* 组件数据适配器配置
|
|
22
|
+
*/
|
|
23
|
+
export interface ComponentDataAdapter {
|
|
24
|
+
/**
|
|
25
|
+
* 数据转换函数(必需)
|
|
26
|
+
* 将提取的数据转换为组件需要的格式
|
|
27
|
+
*
|
|
28
|
+
* @param value - 从原始数据中提取的值
|
|
29
|
+
* @param componentConfig - 组件的配置(可选)
|
|
30
|
+
* @returns 组件需要的数据格式
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* // 数值转仪表盘格式
|
|
34
|
+
* transform: (value, config) => ({
|
|
35
|
+
* value: Number(value),
|
|
36
|
+
* min: config.min || 0,
|
|
37
|
+
* max: config.max || 100
|
|
38
|
+
* })
|
|
39
|
+
*/
|
|
40
|
+
transform: DataTransformer;
|
|
41
|
+
/**
|
|
42
|
+
* 数据验证函数(可选)
|
|
43
|
+
* 验证数据是否符合要求
|
|
44
|
+
*
|
|
45
|
+
* @param value - 需要验证的值
|
|
46
|
+
* @returns 验证是否通过
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* validate: (value) => typeof value === 'number'
|
|
50
|
+
*/
|
|
51
|
+
validate?: DataValidator;
|
|
52
|
+
/**
|
|
53
|
+
* 默认值(可选)
|
|
54
|
+
* 当数据为空或验证失败时使用
|
|
55
|
+
*/
|
|
56
|
+
defaultValue?: any;
|
|
57
|
+
/**
|
|
58
|
+
* 错误处理函数(可选)
|
|
59
|
+
* 当转换失败时调用
|
|
60
|
+
*/
|
|
61
|
+
onError?: (error: Error, value: any) => any;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* 数据绑定配置(增强版)
|
|
65
|
+
*/
|
|
66
|
+
export interface DataBindingConfig {
|
|
67
|
+
/**
|
|
68
|
+
* 数据源 ID
|
|
69
|
+
*/
|
|
70
|
+
dataSourceId: string;
|
|
71
|
+
/**
|
|
72
|
+
* 目标属性(组件的哪个属性)
|
|
73
|
+
*/
|
|
74
|
+
targetProperty: string;
|
|
75
|
+
/**
|
|
76
|
+
* 数据路径(JSONPath 或点分隔路径)
|
|
77
|
+
* 用于从原始数据中提取值
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* 'temperature'
|
|
81
|
+
* 'sensors[0].data.temp'
|
|
82
|
+
* 'payload.devices.find(d => d.id === "001").value'
|
|
83
|
+
*/
|
|
84
|
+
dataPath?: string;
|
|
85
|
+
/**
|
|
86
|
+
* 自定义数据提取器
|
|
87
|
+
* 当 dataPath 不够灵活时使用
|
|
88
|
+
*/
|
|
89
|
+
extractor?: DataExtractor;
|
|
90
|
+
/**
|
|
91
|
+
* 映射配置(保留向后兼容)
|
|
92
|
+
*/
|
|
93
|
+
mapping?: MappingConfig;
|
|
94
|
+
/**
|
|
95
|
+
* 是否启用
|
|
96
|
+
*/
|
|
97
|
+
enabled?: boolean;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* 映射配置(保留向后兼容)
|
|
101
|
+
*/
|
|
102
|
+
export interface MappingConfig {
|
|
103
|
+
type: 'direct' | 'boolean' | 'range' | 'enum' | 'custom';
|
|
104
|
+
trueValue?: any;
|
|
105
|
+
falseValue?: any;
|
|
106
|
+
rangeRules?: Array<{
|
|
107
|
+
min: number;
|
|
108
|
+
max: number;
|
|
109
|
+
value: any;
|
|
110
|
+
}>;
|
|
111
|
+
enumMappings?: Record<string, any>;
|
|
112
|
+
customFunction?: string;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* 数据适配器工具类
|
|
116
|
+
*/
|
|
117
|
+
export declare class DataAdapterUtils {
|
|
118
|
+
/**
|
|
119
|
+
* 从原始数据中提取值(使用数据路径)
|
|
120
|
+
*
|
|
121
|
+
* @param rawData - 原始数据
|
|
122
|
+
* @param dataPath - 数据路径(点分隔或数组索引)
|
|
123
|
+
* @returns 提取的值
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* extractByPath({ a: { b: { c: 1 } } }, 'a.b.c') // 返回 1
|
|
127
|
+
* extractByPath({ arr: [1, 2, 3] }, 'arr[1]') // 返回 2
|
|
128
|
+
*/
|
|
129
|
+
static extractByPath(rawData: any, dataPath: string): any;
|
|
130
|
+
/**
|
|
131
|
+
* 使用提取器从原始数据中提取值
|
|
132
|
+
*
|
|
133
|
+
* @param rawData - 原始数据
|
|
134
|
+
* @param extractor - 提取器函数
|
|
135
|
+
* @returns 提取的值
|
|
136
|
+
*/
|
|
137
|
+
static extractByFunction(rawData: any, extractor: DataExtractor): any;
|
|
138
|
+
/**
|
|
139
|
+
* 应用数据适配器
|
|
140
|
+
*
|
|
141
|
+
* @param value - 提取的值
|
|
142
|
+
* @param adapter - 数据适配器
|
|
143
|
+
* @param componentConfig - 组件配置
|
|
144
|
+
* @returns 转换后的值
|
|
145
|
+
*/
|
|
146
|
+
static applyAdapter(value: any, adapter: ComponentDataAdapter | undefined, componentConfig?: any): any;
|
|
147
|
+
/**
|
|
148
|
+
* 应用旧版映射配置(向后兼容)
|
|
149
|
+
*/
|
|
150
|
+
static applyMapping(value: any, mapping: MappingConfig | undefined): any;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* 预设的数据适配器
|
|
154
|
+
*/
|
|
155
|
+
export declare const PresetDataAdapters: {
|
|
156
|
+
/**
|
|
157
|
+
* 直传适配器(不做任何转换)
|
|
158
|
+
*/
|
|
159
|
+
passthrough: ComponentDataAdapter;
|
|
160
|
+
/**
|
|
161
|
+
* 数值适配器(转换为数字)
|
|
162
|
+
*/
|
|
163
|
+
number: ComponentDataAdapter;
|
|
164
|
+
/**
|
|
165
|
+
* 字符串适配器
|
|
166
|
+
*/
|
|
167
|
+
string: ComponentDataAdapter;
|
|
168
|
+
/**
|
|
169
|
+
* 布尔适配器
|
|
170
|
+
*/
|
|
171
|
+
boolean: ComponentDataAdapter;
|
|
172
|
+
/**
|
|
173
|
+
* 百分比适配器(0-1 转换为 0-100)
|
|
174
|
+
*/
|
|
175
|
+
percentage: ComponentDataAdapter;
|
|
176
|
+
/**
|
|
177
|
+
* 仪表盘适配器
|
|
178
|
+
*/
|
|
179
|
+
gauge: ComponentDataAdapter;
|
|
180
|
+
/**
|
|
181
|
+
* 颜色映射适配器
|
|
182
|
+
*/
|
|
183
|
+
colorMap: ComponentDataAdapter;
|
|
184
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 统一动画调度器
|
|
3
|
+
* 解决多个组件独立使用 requestAnimationFrame 导致的性能问题
|
|
4
|
+
*
|
|
5
|
+
* 优势:
|
|
6
|
+
* 1. 统一时间步进,避免动画不同步
|
|
7
|
+
* 2. 减少 RAF 调用次数,降低浏览器开销
|
|
8
|
+
* 3. 集中管理所有动画,便于调试和性能监控
|
|
9
|
+
* 4. 支持动画暂停/恢复/销毁
|
|
10
|
+
*/
|
|
11
|
+
export interface AnimationTask {
|
|
12
|
+
id: string;
|
|
13
|
+
callback: (deltaTime: number, currentTime: number) => void;
|
|
14
|
+
enabled: boolean;
|
|
15
|
+
lastTime: number;
|
|
16
|
+
}
|
|
17
|
+
declare class AnimationScheduler {
|
|
18
|
+
private tasks;
|
|
19
|
+
private rafId;
|
|
20
|
+
private isRunning;
|
|
21
|
+
private lastFrameTime;
|
|
22
|
+
private frameCount;
|
|
23
|
+
private fpsUpdateTime;
|
|
24
|
+
private currentFps;
|
|
25
|
+
/**
|
|
26
|
+
* 注册动画任务
|
|
27
|
+
* @param id 唯一标识符(通常使用组件 nodeId)
|
|
28
|
+
* @param callback 动画回调函数 (deltaTime: 距上次调用的毫秒数, currentTime: 当前时间戳)
|
|
29
|
+
*/
|
|
30
|
+
register(id: string, callback: (deltaTime: number, currentTime: number) => void): void;
|
|
31
|
+
/**
|
|
32
|
+
* 注销动画任务
|
|
33
|
+
* @param id 任务标识符
|
|
34
|
+
*/
|
|
35
|
+
unregister(id: string): void;
|
|
36
|
+
/**
|
|
37
|
+
* 启用/禁用特定任务
|
|
38
|
+
* @param id 任务标识符
|
|
39
|
+
* @param enabled 是否启用
|
|
40
|
+
*/
|
|
41
|
+
setEnabled(id: string, enabled: boolean): void;
|
|
42
|
+
/**
|
|
43
|
+
* 启动调度器
|
|
44
|
+
*/
|
|
45
|
+
private start;
|
|
46
|
+
/**
|
|
47
|
+
* 停止调度器
|
|
48
|
+
*/
|
|
49
|
+
private stop;
|
|
50
|
+
/**
|
|
51
|
+
* 动画帧循环
|
|
52
|
+
*/
|
|
53
|
+
private tick;
|
|
54
|
+
/**
|
|
55
|
+
* 获取当前 FPS
|
|
56
|
+
*/
|
|
57
|
+
getFps(): number;
|
|
58
|
+
/**
|
|
59
|
+
* 获取活跃任务数量
|
|
60
|
+
*/
|
|
61
|
+
getActiveTaskCount(): number;
|
|
62
|
+
/**
|
|
63
|
+
* 暂停所有动画
|
|
64
|
+
*/
|
|
65
|
+
pauseAll(): void;
|
|
66
|
+
/**
|
|
67
|
+
* 恢复所有动画
|
|
68
|
+
*/
|
|
69
|
+
resumeAll(): void;
|
|
70
|
+
/**
|
|
71
|
+
* 清除所有任务并停止调度器
|
|
72
|
+
*/
|
|
73
|
+
destroy(): void;
|
|
74
|
+
/**
|
|
75
|
+
* 获取调度器状态(用于调试)
|
|
76
|
+
*/
|
|
77
|
+
getStatus(): {
|
|
78
|
+
isRunning: boolean;
|
|
79
|
+
taskCount: number;
|
|
80
|
+
activeTaskCount: number;
|
|
81
|
+
fps: number;
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
export declare const animationScheduler: AnimationScheduler;
|
|
85
|
+
export {};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { Graph } from '@antv/x6';
|
|
2
|
+
|
|
3
|
+
export declare enum CanvasLayer {
|
|
4
|
+
BACKGROUND = "background",
|
|
5
|
+
STATIC = "static",
|
|
6
|
+
ANIMATION = "animation",
|
|
7
|
+
INTERACTION = "interaction",
|
|
8
|
+
HIGHLIGHT = "highlight"
|
|
9
|
+
}
|
|
10
|
+
export declare class CanvasLayerManager {
|
|
11
|
+
private graph;
|
|
12
|
+
private layers;
|
|
13
|
+
private layerConfig;
|
|
14
|
+
private containerElement;
|
|
15
|
+
private dirtyLayers;
|
|
16
|
+
private renderScheduled;
|
|
17
|
+
private staticNodes;
|
|
18
|
+
private animationNodes;
|
|
19
|
+
/**
|
|
20
|
+
* 初始化分层系统
|
|
21
|
+
*/
|
|
22
|
+
init(graph: Graph, container: HTMLElement): void;
|
|
23
|
+
/**
|
|
24
|
+
* 创建图层 Canvas
|
|
25
|
+
*/
|
|
26
|
+
private createLayer;
|
|
27
|
+
/**
|
|
28
|
+
* 附加事件监听器
|
|
29
|
+
*/
|
|
30
|
+
private attachEventListeners;
|
|
31
|
+
/**
|
|
32
|
+
* 标记图层为脏(需要重绘)
|
|
33
|
+
*/
|
|
34
|
+
markDirty(layer: CanvasLayer): void;
|
|
35
|
+
/**
|
|
36
|
+
* 调度渲染
|
|
37
|
+
*/
|
|
38
|
+
private scheduleRender;
|
|
39
|
+
/**
|
|
40
|
+
* 渲染所有脏图层
|
|
41
|
+
*/
|
|
42
|
+
private render;
|
|
43
|
+
/**
|
|
44
|
+
* 渲染单个图层
|
|
45
|
+
*/
|
|
46
|
+
private renderLayer;
|
|
47
|
+
/**
|
|
48
|
+
* 渲染背景层
|
|
49
|
+
*/
|
|
50
|
+
private renderBackground;
|
|
51
|
+
/**
|
|
52
|
+
* 渲染静态层
|
|
53
|
+
*/
|
|
54
|
+
private renderStatic;
|
|
55
|
+
/**
|
|
56
|
+
* 渲染动画层
|
|
57
|
+
*/
|
|
58
|
+
private renderAnimation;
|
|
59
|
+
/**
|
|
60
|
+
* 渲染交互层
|
|
61
|
+
*/
|
|
62
|
+
private renderInteraction;
|
|
63
|
+
/**
|
|
64
|
+
* 渲染高亮层
|
|
65
|
+
*/
|
|
66
|
+
private renderHighlight;
|
|
67
|
+
/**
|
|
68
|
+
* 标记节点为动画节点
|
|
69
|
+
*/
|
|
70
|
+
markAsAnimation(nodeId: string): void;
|
|
71
|
+
/**
|
|
72
|
+
* 标记节点为静态节点
|
|
73
|
+
*/
|
|
74
|
+
markAsStatic(nodeId: string): void;
|
|
75
|
+
/**
|
|
76
|
+
* 获取性能统计
|
|
77
|
+
*/
|
|
78
|
+
getStats(): {
|
|
79
|
+
staticNodes: number;
|
|
80
|
+
animationNodes: number;
|
|
81
|
+
dirtyLayers: number;
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* 销毁分层系统
|
|
85
|
+
*/
|
|
86
|
+
destroy(): void;
|
|
87
|
+
}
|
|
88
|
+
export declare const canvasLayerManager: CanvasLayerManager;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Graph } from '@antv/x6';
|
|
2
|
+
import { BindingConfig } from '../types/binding';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* 数据绑定服务类
|
|
@@ -6,6 +7,9 @@ import { Graph } from '@antv/x6';
|
|
|
6
7
|
export declare class DataBindingService {
|
|
7
8
|
private graph;
|
|
8
9
|
private dataCallbackRegistered;
|
|
10
|
+
private updateQueue;
|
|
11
|
+
private flushTimer;
|
|
12
|
+
private readonly FLUSH_DELAY;
|
|
9
13
|
/**
|
|
10
14
|
* 设置 Graph 实例
|
|
11
15
|
*/
|
|
@@ -13,30 +17,70 @@ export declare class DataBindingService {
|
|
|
13
17
|
/**
|
|
14
18
|
* 初始化数据绑定监听
|
|
15
19
|
*/
|
|
16
|
-
initDataBinding
|
|
20
|
+
private initDataBinding;
|
|
17
21
|
/**
|
|
18
|
-
*
|
|
22
|
+
* 处理数据源更新
|
|
19
23
|
*/
|
|
20
|
-
private
|
|
24
|
+
private handleDataUpdate;
|
|
21
25
|
/**
|
|
22
|
-
*
|
|
26
|
+
* 更新单个节点的数据
|
|
23
27
|
*/
|
|
24
|
-
private
|
|
28
|
+
private updateNodeData;
|
|
25
29
|
/**
|
|
26
|
-
*
|
|
30
|
+
* 将更新添加到队列
|
|
27
31
|
*/
|
|
28
|
-
private
|
|
32
|
+
private queueUpdates;
|
|
29
33
|
/**
|
|
30
|
-
*
|
|
34
|
+
* 调度批量刷新
|
|
31
35
|
*/
|
|
32
|
-
|
|
36
|
+
private scheduleFlush;
|
|
37
|
+
/**
|
|
38
|
+
* 执行批量更新
|
|
39
|
+
*/
|
|
40
|
+
private flush;
|
|
41
|
+
/**
|
|
42
|
+
* 从原始数据中提取点位值
|
|
43
|
+
*
|
|
44
|
+
* @param rawData 原始数据(后端返回的JSON)
|
|
45
|
+
* @param pointId 点位ID(如 "liquid_level")
|
|
46
|
+
* @returns 点位值
|
|
47
|
+
*/
|
|
48
|
+
private extractPointValue;
|
|
49
|
+
/**
|
|
50
|
+
* 应用值映射转换
|
|
51
|
+
*
|
|
52
|
+
* @param value 原始值
|
|
53
|
+
* @param mapping 映射配置
|
|
54
|
+
* @returns 转换后的值
|
|
55
|
+
*/
|
|
56
|
+
private applyValueMapping;
|
|
57
|
+
/**
|
|
58
|
+
* 布尔映射
|
|
59
|
+
*/
|
|
60
|
+
private applyBooleanMapping;
|
|
61
|
+
/**
|
|
62
|
+
* 范围映射
|
|
63
|
+
*/
|
|
64
|
+
private applyRangeMapping;
|
|
65
|
+
/**
|
|
66
|
+
* 枚举映射
|
|
67
|
+
*/
|
|
68
|
+
private applyEnumMapping;
|
|
69
|
+
/**
|
|
70
|
+
* 应用更新到节点
|
|
71
|
+
*/
|
|
72
|
+
private applyUpdatesToNode;
|
|
33
73
|
/**
|
|
34
74
|
* 获取节点的绑定配置
|
|
35
75
|
*/
|
|
36
|
-
getNodeBindings(nodeId: string):
|
|
76
|
+
getNodeBindings(nodeId: string): BindingConfig[];
|
|
37
77
|
/**
|
|
38
78
|
* 更新节点的绑定配置
|
|
39
79
|
*/
|
|
40
|
-
updateNodeBindings(nodeId: string, bindings:
|
|
80
|
+
updateNodeBindings(nodeId: string, bindings: BindingConfig[]): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* 清理资源
|
|
83
|
+
*/
|
|
84
|
+
destroy(): void;
|
|
41
85
|
}
|
|
42
86
|
export declare const dataBindingService: DataBindingService;
|
|
@@ -16,3 +16,7 @@ export * from './dataBindingService';
|
|
|
16
16
|
export * from './eventManager';
|
|
17
17
|
export * from './contextMenuManager';
|
|
18
18
|
export * from './canvasConfigWatcher';
|
|
19
|
+
export * from './animationScheduler';
|
|
20
|
+
export * from './viewportCulling';
|
|
21
|
+
export * from './workerManager';
|
|
22
|
+
export * from './canvasLayerManager';
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Graph } from '@antv/x6';
|
|
2
|
+
|
|
3
|
+
interface ViewportConfig {
|
|
4
|
+
enabled: boolean;
|
|
5
|
+
padding: number;
|
|
6
|
+
updateThrottle: number;
|
|
7
|
+
}
|
|
8
|
+
declare class ViewportCullingService {
|
|
9
|
+
private graph;
|
|
10
|
+
private config;
|
|
11
|
+
private updateTimer;
|
|
12
|
+
private isUpdating;
|
|
13
|
+
private nodeVisibilityCache;
|
|
14
|
+
private stats;
|
|
15
|
+
/**
|
|
16
|
+
* 初始化服务
|
|
17
|
+
*/
|
|
18
|
+
init(graph: Graph, config?: Partial<ViewportConfig>): void;
|
|
19
|
+
/**
|
|
20
|
+
* 调度更新(节流)
|
|
21
|
+
*/
|
|
22
|
+
private scheduleUpdate;
|
|
23
|
+
/**
|
|
24
|
+
* 更新节点可见性
|
|
25
|
+
*/
|
|
26
|
+
private updateVisibility;
|
|
27
|
+
/**
|
|
28
|
+
* 获取视口矩形区域
|
|
29
|
+
*/
|
|
30
|
+
private getViewportRect;
|
|
31
|
+
/**
|
|
32
|
+
* 判断节点是否在视口内
|
|
33
|
+
*/
|
|
34
|
+
private isNodeInViewport;
|
|
35
|
+
/**
|
|
36
|
+
* 强制更新所有节点可见性
|
|
37
|
+
*/
|
|
38
|
+
forceUpdate(): void;
|
|
39
|
+
/**
|
|
40
|
+
* 启用/禁用视口裁剪
|
|
41
|
+
*/
|
|
42
|
+
setEnabled(enabled: boolean): void;
|
|
43
|
+
/**
|
|
44
|
+
* 显示所有节点
|
|
45
|
+
*/
|
|
46
|
+
private showAllNodes;
|
|
47
|
+
/**
|
|
48
|
+
* 获取性能统计
|
|
49
|
+
*/
|
|
50
|
+
getStats(): {
|
|
51
|
+
totalNodes: number;
|
|
52
|
+
visibleNodes: number;
|
|
53
|
+
culledNodes: number;
|
|
54
|
+
cullRate: string;
|
|
55
|
+
lastUpdateTime: number;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* 销毁服务
|
|
59
|
+
*/
|
|
60
|
+
destroy(): void;
|
|
61
|
+
}
|
|
62
|
+
export declare const viewportCulling: ViewportCullingService;
|
|
63
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Worker 管理器
|
|
3
|
+
* 管理 WebWorker 生命周期和消息通信
|
|
4
|
+
*/
|
|
5
|
+
export declare class WorkerManager {
|
|
6
|
+
private worker;
|
|
7
|
+
private pendingTasks;
|
|
8
|
+
private messageIdCounter;
|
|
9
|
+
private readonly TASK_TIMEOUT;
|
|
10
|
+
/**
|
|
11
|
+
* 初始化 Worker
|
|
12
|
+
*/
|
|
13
|
+
init(): void;
|
|
14
|
+
/**
|
|
15
|
+
* 处理 Worker 消息
|
|
16
|
+
*/
|
|
17
|
+
private handleMessage;
|
|
18
|
+
/**
|
|
19
|
+
* 处理 Worker 错误
|
|
20
|
+
*/
|
|
21
|
+
private handleError;
|
|
22
|
+
/**
|
|
23
|
+
* 发送消息到 Worker
|
|
24
|
+
*/
|
|
25
|
+
private sendMessage;
|
|
26
|
+
/**
|
|
27
|
+
* 主线程回退处理
|
|
28
|
+
*/
|
|
29
|
+
private fallbackProcess;
|
|
30
|
+
/**
|
|
31
|
+
* 解析设备数据
|
|
32
|
+
*/
|
|
33
|
+
parseDeviceData(rawData: any): Promise<any>;
|
|
34
|
+
/**
|
|
35
|
+
* 转换绑定数据
|
|
36
|
+
*/
|
|
37
|
+
transformBindingData(bindings: any[], deviceData: any): Promise<any[]>;
|
|
38
|
+
/**
|
|
39
|
+
* 批量计算
|
|
40
|
+
*/
|
|
41
|
+
batchCalculate(calculations: Array<{
|
|
42
|
+
type: string;
|
|
43
|
+
params: any;
|
|
44
|
+
}>): Promise<any[]>;
|
|
45
|
+
/**
|
|
46
|
+
* 获取 Worker 状态
|
|
47
|
+
*/
|
|
48
|
+
getStatus(): {
|
|
49
|
+
isActive: boolean;
|
|
50
|
+
pendingTasks: number;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* 终止 Worker
|
|
54
|
+
*/
|
|
55
|
+
terminate(): void;
|
|
56
|
+
}
|
|
57
|
+
export declare const workerManager: WorkerManager;
|
|
@@ -1,13 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
name: string;
|
|
4
|
-
type: string;
|
|
5
|
-
icon: string;
|
|
6
|
-
properties: Array<{
|
|
7
|
-
key: string;
|
|
8
|
-
label: string;
|
|
9
|
-
}>;
|
|
10
|
-
}
|
|
1
|
+
import { ElementInfo } from '../types/element';
|
|
2
|
+
|
|
11
3
|
interface Props {
|
|
12
4
|
visible: boolean;
|
|
13
5
|
elements?: ElementInfo[];
|
|
@@ -8,9 +8,9 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
8
8
|
close: () => void;
|
|
9
9
|
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<Props>>> & Readonly<{
|
|
10
10
|
onSave?: (() => any) | undefined;
|
|
11
|
+
onValidate?: (() => any) | undefined;
|
|
11
12
|
onClear?: (() => any) | undefined;
|
|
12
13
|
onClose?: (() => any) | undefined;
|
|
13
|
-
onValidate?: (() => any) | undefined;
|
|
14
14
|
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
15
15
|
export default _default;
|
|
16
16
|
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Graph } from '@antv/x6';
|
|
2
|
-
import { ElementInfo } from '../
|
|
2
|
+
import { ElementInfo } from '../types/element';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* 画布图元服务类
|
|
@@ -13,7 +13,7 @@ declare class CanvasElementService {
|
|
|
13
13
|
/**
|
|
14
14
|
* 获取画布所有图元
|
|
15
15
|
*/
|
|
16
|
-
getElements(): ElementInfo[]
|
|
16
|
+
getElements(): Promise<ElementInfo[]>;
|
|
17
17
|
/**
|
|
18
18
|
* 获取图元的可配置属性列表(仅返回组件 props 中定义的属性)
|
|
19
19
|
*/
|
|
@@ -21,11 +21,11 @@ declare class CanvasElementService {
|
|
|
21
21
|
/**
|
|
22
22
|
* 根据ID获取图元
|
|
23
23
|
*/
|
|
24
|
-
getElementById(id: string): ElementInfo | null
|
|
24
|
+
getElementById(id: string): Promise<ElementInfo | null>;
|
|
25
25
|
/**
|
|
26
26
|
* 搜索图元
|
|
27
27
|
*/
|
|
28
|
-
searchElements(keyword: string): ElementInfo[]
|
|
28
|
+
searchElements(keyword: string): Promise<ElementInfo[]>;
|
|
29
29
|
}
|
|
30
30
|
export declare const canvasElementService: CanvasElementService;
|
|
31
31
|
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 数据处理 Worker
|
|
3
|
+
* 在后台线程处理复杂数据转换,避免阻塞主线程
|
|
4
|
+
*/
|
|
5
|
+
export declare enum WorkerMessageType {
|
|
6
|
+
PARSE_DEVICE_DATA = "PARSE_DEVICE_DATA",
|
|
7
|
+
TRANSFORM_BINDING_DATA = "TRANSFORM_BINDING_DATA",
|
|
8
|
+
BATCH_CALCULATE = "BATCH_CALCULATE",
|
|
9
|
+
ERROR = "ERROR"
|
|
10
|
+
}
|
|
11
|
+
export interface WorkerMessage {
|
|
12
|
+
id: string;
|
|
13
|
+
type: WorkerMessageType;
|
|
14
|
+
payload: any;
|
|
15
|
+
}
|
|
16
|
+
export interface WorkerResponse {
|
|
17
|
+
id: string;
|
|
18
|
+
type: WorkerMessageType;
|
|
19
|
+
result?: any;
|
|
20
|
+
error?: string;
|
|
21
|
+
}
|