@nywqs/scada-engine 1.1.30 → 2.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 -21
- package/README.md +359 -193
- package/dist/index.d.ts +3 -0
- package/dist/scada-engine.css +1 -1
- package/dist/scada-engine.es.js +42794 -21383
- package/dist/scada-engine.umd.js +3751 -156
- package/dist/src/components/canvas/composables/index.d.ts +12 -0
- package/dist/src/components/canvas/composables/useAutoSave.d.ts +9 -0
- package/dist/src/components/canvas/composables/useCanvasScale.d.ts +12 -0
- package/dist/src/components/canvas/composables/useDataSource.d.ts +87 -0
- package/dist/src/components/canvas/composables/useFileOperations.d.ts +37 -0
- package/dist/src/components/canvas/composables/useGraphEvents.d.ts +22 -0
- package/dist/src/components/canvas/composables/useNodeOperations.d.ts +35 -0
- package/dist/src/components/canvas/config/graphConfig.d.ts +64 -0
- package/dist/src/components/canvas/config/pluginConfig.d.ts +5 -0
- package/dist/src/components/canvas/config/scadaEdgeShape.d.ts +14 -0
- package/dist/src/components/canvas/config/scadaEdgeView.d.ts +4 -0
- package/dist/src/components/canvas/types/canvas.d.ts +41 -0
- package/dist/src/components/configurators/BindingCard.d.ts +24 -0
- package/dist/src/components/configurators/ComponentPointSelector.d.ts +16 -0
- package/dist/src/components/{EventCard.d.ts → configurators/EventCard.d.ts} +13 -26
- package/dist/src/components/configurators/MappingConfigurator.d.ts +15 -0
- package/dist/src/components/dialogs/AttributeConfigDialog.d.ts +28 -0
- package/dist/src/components/dialogs/CustomCodeDialog.d.ts +20 -0
- package/dist/src/components/dialogs/DataSourceDialog.d.ts +16 -0
- package/dist/src/components/dialogs/ScadaModal.d.ts +37 -0
- package/dist/src/components/{WorkflowSelectorDialog.d.ts → dialogs/WorkflowSelectorDialog.d.ts} +3 -3
- package/dist/src/components/layout/Footer.d.ts +16 -0
- package/dist/src/components/layout/Header.d.ts +56 -0
- package/dist/src/components/panels/CanvasConfigPanel.d.ts +4 -0
- package/dist/src/components/panels/ComponentLibrary.d.ts +6 -0
- package/dist/src/components/panels/ContextMenu.d.ts +26 -0
- package/dist/src/components/panels/PropertyPanel.d.ts +22 -0
- package/dist/src/components/property-tabs/BasicPropertiesTab.d.ts +37 -0
- package/dist/src/components/property-tabs/DataPropertiesTab.d.ts +14 -0
- package/dist/src/components/property-tabs/EdgePropertiesTab.d.ts +16 -0
- package/dist/src/constants/animation.d.ts +5 -0
- package/dist/src/constants/index.d.ts +3 -0
- package/dist/src/constants/layout.d.ts +16 -0
- package/dist/src/constants/theme.d.ts +17 -0
- package/dist/src/index.d.ts +16 -15
- package/dist/src/main.d.ts +0 -1
- package/dist/src/scada-components/basic/circle.d.ts +0 -1
- package/dist/src/scada-components/basic/rect.d.ts +0 -1
- package/dist/src/scada-components/basic/text.d.ts +0 -1
- package/dist/src/scada-components/canvas/config.d.ts +0 -1
- package/dist/src/scada-components/canvas/manager.d.ts +0 -1
- package/dist/src/scada-components/iot/echarts-gauge/EChartsGauge.d.ts +7 -0
- package/dist/src/scada-components/iot/{echarts-gauge.d.ts → echarts-gauge/index.d.ts} +1 -2
- package/dist/src/scada-components/iot/echarts-line/EChartsLine.d.ts +7 -0
- package/dist/src/scada-components/iot/{echarts-line.d.ts → echarts-line/index.d.ts} +1 -2
- package/dist/src/scada-components/iot/index.d.ts +0 -5
- package/dist/src/scada-components/registry.d.ts +1 -2
- package/dist/src/scada-components/svg/core/index.d.ts +7 -0
- package/dist/src/scada-components/svg/core/loader.d.ts +71 -0
- package/dist/src/scada-components/svg/core/parser.d.ts +40 -0
- package/dist/src/scada-components/svg/core/types.d.ts +297 -0
- package/dist/src/scada-components/svg/helpers/demo.d.ts +20 -0
- package/dist/src/scada-components/svg/helpers/index.d.ts +5 -0
- package/dist/src/scada-components/svg/helpers/utils.d.ts +24 -0
- package/dist/src/scada-components/svg/index.d.ts +9 -0
- package/dist/src/scada-components/svg/rendering/SVGRenderer.d.ts +14 -0
- package/dist/src/scada-components/svg/rendering/animationTemplates.d.ts +81 -0
- package/dist/src/scada-components/svg/rendering/index.d.ts +6 -0
- package/dist/src/scada-components/types.d.ts +0 -1
- package/dist/src/types/context-menu.d.ts +13 -0
- package/dist/src/types/model3d.d.ts +106 -0
- package/dist/src/types/zone.d.ts +54 -0
- package/dist/src/utils/animation/index.d.ts +6 -0
- package/dist/src/utils/{canvasConfigWatcher.d.ts → canvas/config-watcher.d.ts} +19 -9
- package/dist/src/utils/{canvasDataHandler.d.ts → canvas/data-handler.d.ts} +0 -29
- package/dist/src/utils/{edgeOperations.d.ts → canvas/edge-operations.d.ts} +6 -3
- package/dist/src/utils/{graphOperations.d.ts → canvas/graph-operations.d.ts} +0 -1
- package/dist/src/utils/canvas/index.d.ts +10 -0
- package/dist/src/utils/{canvasLayerManager.d.ts → canvas/layer-manager.d.ts} +0 -1
- package/dist/src/utils/{nodeOperations.d.ts → canvas/node-operations.d.ts} +0 -1
- package/dist/src/utils/core/index.d.ts +8 -0
- package/dist/src/utils/{dataBindingService.d.ts → data/binding-service.d.ts} +1 -2
- package/dist/src/utils/data/index.d.ts +6 -0
- package/dist/src/utils/{contextMenuManager.d.ts → events/context-menu.d.ts} +1 -2
- package/dist/src/utils/{eventManager.d.ts → events/event-manager.d.ts} +1 -2
- package/dist/src/utils/events/index.d.ts +7 -0
- package/dist/src/utils/index.d.ts +30 -19
- package/dist/src/utils/integrations/draco-loader.d.ts +2 -0
- package/dist/src/utils/integrations/index.d.ts +6 -0
- package/dist/src/utils/performance/index.d.ts +6 -0
- package/dist/src/utils/{viewportCulling.d.ts → performance/viewport-culling.d.ts} +0 -1
- package/dist/src/views/Preview.d.ts +4 -0
- package/dist/src/views/workflow/WorkflowDialog.d.ts +10 -30
- package/dist/src/views/workflow/components/AddNodeMenu.d.ts +5 -14
- package/dist/src/views/workflow/components/ElementSelector.d.ts +5 -27
- package/dist/src/views/workflow/components/PropertyPanel.d.ts +8 -15
- package/dist/src/views/workflow/components/node-configs/ClearTimerConfig.d.ts +4 -14
- package/dist/src/views/workflow/components/node-configs/ConditionConfig.d.ts +4 -14
- package/dist/src/views/workflow/components/node-configs/CustomCodeConfig.d.ts +4 -14
- package/dist/src/views/workflow/components/node-configs/GetPropertyConfig.d.ts +4 -14
- package/dist/src/views/workflow/components/node-configs/HttpRequestConfig.d.ts +4 -14
- package/dist/src/views/workflow/components/node-configs/SetPropertyConfig.d.ts +4 -14
- package/dist/src/views/workflow/components/node-configs/TimerConfig.d.ts +4 -14
- package/dist/src/views/workflow/config/nodeConfigRegistry.d.ts +0 -1
- package/dist/src/views/workflow/services/canvasElementService.d.ts +0 -1
- package/package.json +86 -82
- package/dist/src/components/AttributeConfigDialog.d.ts +0 -39
- package/dist/src/components/BasicPropertiesTab.d.ts +0 -51
- package/dist/src/components/BindingCard.d.ts +0 -39
- package/dist/src/components/CanvasArea.d.ts +0 -4
- package/dist/src/components/ComponentLibrary.d.ts +0 -34
- package/dist/src/components/ComponentPointSelector.d.ts +0 -29
- package/dist/src/components/ContextMenu.d.ts +0 -63
- package/dist/src/components/CustomCodeDialog.d.ts +0 -30
- package/dist/src/components/DataPropertiesTab.d.ts +0 -24
- package/dist/src/components/DataSourceDialog.d.ts +0 -26
- package/dist/src/components/EdgePropertiesTab.d.ts +0 -22
- package/dist/src/components/Footer.d.ts +0 -41
- package/dist/src/components/Header.d.ts +0 -73
- package/dist/src/components/MappingConfigurator.d.ts +0 -27
- package/dist/src/components/PropertyPanel.d.ts +0 -45
- package/dist/src/scada-components/iot/AlarmLight3D.d.ts +0 -14
- package/dist/src/scada-components/iot/Conveyor3D.d.ts +0 -14
- package/dist/src/scada-components/iot/Cylinder3D.d.ts +0 -14
- package/dist/src/scada-components/iot/EChartsGauge.d.ts +0 -14
- package/dist/src/scada-components/iot/EChartsLine.d.ts +0 -14
- package/dist/src/scada-components/iot/Filter3D.d.ts +0 -14
- package/dist/src/scada-components/iot/HeatExchanger3D.d.ts +0 -14
- package/dist/src/scada-components/iot/Light3D.d.ts +0 -14
- package/dist/src/scada-components/iot/Motor3D.d.ts +0 -14
- package/dist/src/scada-components/iot/Pipe3D.d.ts +0 -14
- package/dist/src/scada-components/iot/Pump3D.d.ts +0 -14
- package/dist/src/scada-components/iot/Switch3D.d.ts +0 -14
- package/dist/src/scada-components/iot/Tank3D.d.ts +0 -14
- package/dist/src/scada-components/iot/Tee3D.d.ts +0 -14
- package/dist/src/scada-components/iot/TemperatureSensor3D.d.ts +0 -14
- package/dist/src/scada-components/iot/Valve3D.d.ts +0 -14
- package/dist/src/scada-components/iot/industrial-3d-extended.d.ts +0 -18
- package/dist/src/scada-components/iot/industrial-3d-fluid.d.ts +0 -18
- package/dist/src/scada-components/iot/industrial-3d.d.ts +0 -18
- package/dist/src/scada-components/iot/light.d.ts +0 -6
- package/dist/src/scada-components/iot/switch.d.ts +0 -6
- package/dist/src/views/workflow/WorkflowEditor.d.ts +0 -38
- package/dist/src/views/workflow/components/WorkflowToolbar.d.ts +0 -24
- /package/dist/src/{components/CanvasConfigPanel.d.ts → App.d.ts} +0 -0
- /package/dist/src/scada-components/iot/{echarts-gauge-presets.d.ts → echarts-gauge/presets.d.ts} +0 -0
- /package/dist/src/scada-components/iot/{echarts-line-presets.d.ts → echarts-line/presets.d.ts} +0 -0
- /package/dist/src/utils/{animationEngine.d.ts → animation/animation-engine.d.ts} +0 -0
- /package/dist/src/utils/{animationScheduler.d.ts → animation/animation-scheduler.d.ts} +0 -0
- /package/dist/src/utils/{commonUtils.d.ts → core/common.d.ts} +0 -0
- /package/dist/src/utils/{fileUtils.d.ts → core/file.d.ts} +0 -0
- /package/dist/src/utils/{messageUtils.d.ts → core/message.d.ts} +0 -0
- /package/dist/src/utils/{storageUtils.d.ts → core/storage.d.ts} +0 -0
- /package/dist/src/utils/{nodePropertyUtils.d.ts → data/node-property.d.ts} +0 -0
- /package/dist/src/utils/{eventUtils.d.ts → events/event-utils.d.ts} +0 -0
- /package/dist/src/utils/{authCrypto.d.ts → integrations/auth-crypto.d.ts} +0 -0
- /package/dist/src/utils/{workerManager.d.ts → performance/worker-manager.d.ts} +0 -0
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SVG 组件类型定义
|
|
3
|
+
* 支持外部数据驱动的内部局部动画
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* 动画模板类型(预设的业务语义动画)
|
|
7
|
+
*/
|
|
8
|
+
export declare enum AnimationTemplateType {
|
|
9
|
+
/** 开度 → 旋转 (0~1 → 0~90°) */
|
|
10
|
+
OPENING_ROTATE = "opening-rotate",
|
|
11
|
+
/** 液位 → 高度 (0~100 → 填充高度) */
|
|
12
|
+
LEVEL_HEIGHT = "level-height",
|
|
13
|
+
/** 状态 → 颜色 (枚举/布尔 → 颜色映射) */
|
|
14
|
+
STATUS_COLOR = "status-color",
|
|
15
|
+
/** 数值 → 位置 (0~1 → 滑块位移) */
|
|
16
|
+
VALUE_POSITION = "value-position",
|
|
17
|
+
/** 速度 → 流动 (0~100 → stroke-dashoffset 动画速度) */
|
|
18
|
+
SPEED_FLOW = "speed-flow",
|
|
19
|
+
/** 透明度映射 (0~1 → opacity) */
|
|
20
|
+
VALUE_OPACITY = "value-opacity",
|
|
21
|
+
/** 字符串 → 文本内容 (直接显示) */
|
|
22
|
+
VALUE_TEXT = "value-text",
|
|
23
|
+
/** 自定义 (用户完全自定义) */
|
|
24
|
+
CUSTOM = "custom"
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* 内部 SVG 部件定义
|
|
28
|
+
*/
|
|
29
|
+
export interface SVGPart {
|
|
30
|
+
/** 部件 ID(对应 SVG 中的 id 属性) */
|
|
31
|
+
id: string;
|
|
32
|
+
/** 部件名称(可读) */
|
|
33
|
+
name?: string;
|
|
34
|
+
/** SVG 元素类型 */
|
|
35
|
+
elementType?: 'g' | 'rect' | 'circle' | 'path' | 'polygon' | 'text' | 'line';
|
|
36
|
+
/** 部件描述 */
|
|
37
|
+
description?: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* 内部动画配置
|
|
41
|
+
*/
|
|
42
|
+
export interface InternalAnimationConfig {
|
|
43
|
+
/** 动画 ID */
|
|
44
|
+
id: string;
|
|
45
|
+
/** 目标 SVG 部件 ID */
|
|
46
|
+
partId: string;
|
|
47
|
+
/** 驱动字段(node.data 中的字段名) */
|
|
48
|
+
driverProperty: string;
|
|
49
|
+
/** 动画模板类型 */
|
|
50
|
+
templateType: AnimationTemplateType;
|
|
51
|
+
/** 模板参数(根据不同模板有不同结构) */
|
|
52
|
+
templateParams?: AnimationTemplateParams;
|
|
53
|
+
/** 是否启用 */
|
|
54
|
+
enabled?: boolean;
|
|
55
|
+
/** 过渡时长(ms) */
|
|
56
|
+
transitionDuration?: number;
|
|
57
|
+
/** 缓动函数 */
|
|
58
|
+
easing?: 'linear' | 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out';
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* 动画模板参数(联合类型)
|
|
62
|
+
*/
|
|
63
|
+
export type AnimationTemplateParams = OpeningRotateParams | LevelHeightParams | StatusColorParams | ValuePositionParams | SpeedFlowParams | ValueOpacityParams | ValueTextParams | CustomParams;
|
|
64
|
+
/**
|
|
65
|
+
* 开度 → 旋转 参数
|
|
66
|
+
*/
|
|
67
|
+
export interface OpeningRotateParams {
|
|
68
|
+
type: AnimationTemplateType.OPENING_ROTATE;
|
|
69
|
+
/** 输入范围 */
|
|
70
|
+
inputRange: {
|
|
71
|
+
min: number;
|
|
72
|
+
max: number;
|
|
73
|
+
};
|
|
74
|
+
/** 输出角度范围(度) */
|
|
75
|
+
outputRange: {
|
|
76
|
+
min: number;
|
|
77
|
+
max: number;
|
|
78
|
+
};
|
|
79
|
+
/** 旋转中心 */
|
|
80
|
+
origin?: 'center' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | string;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* 液位 → 高度 参数
|
|
84
|
+
*/
|
|
85
|
+
export interface LevelHeightParams {
|
|
86
|
+
type: AnimationTemplateType.LEVEL_HEIGHT;
|
|
87
|
+
/** 输入范围 */
|
|
88
|
+
inputRange: {
|
|
89
|
+
min: number;
|
|
90
|
+
max: number;
|
|
91
|
+
};
|
|
92
|
+
/** 填充方向 */
|
|
93
|
+
direction?: 'bottom-up' | 'top-down' | 'left-right' | 'right-left';
|
|
94
|
+
/** 容器高度/宽度(默认使用元素自身尺寸) */
|
|
95
|
+
containerSize?: number;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* 状态 → 颜色 参数
|
|
99
|
+
*/
|
|
100
|
+
export interface StatusColorParams {
|
|
101
|
+
type: AnimationTemplateType.STATUS_COLOR;
|
|
102
|
+
/** 颜色映射表 */
|
|
103
|
+
colorMap: Record<string | number, string>;
|
|
104
|
+
/** 默认颜色 */
|
|
105
|
+
defaultColor?: string;
|
|
106
|
+
/** 应用到的属性 */
|
|
107
|
+
applyTo?: 'fill' | 'stroke' | 'both';
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* 数值 → 位置 参数
|
|
111
|
+
*/
|
|
112
|
+
export interface ValuePositionParams {
|
|
113
|
+
type: AnimationTemplateType.VALUE_POSITION;
|
|
114
|
+
/** 输入范围 */
|
|
115
|
+
inputRange: {
|
|
116
|
+
min: number;
|
|
117
|
+
max: number;
|
|
118
|
+
};
|
|
119
|
+
/** 移动方向和距离 */
|
|
120
|
+
movement: {
|
|
121
|
+
axis: 'x' | 'y';
|
|
122
|
+
distance: number;
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* 速度 → 流动 参数
|
|
127
|
+
*/
|
|
128
|
+
export interface SpeedFlowParams {
|
|
129
|
+
type: AnimationTemplateType.SPEED_FLOW;
|
|
130
|
+
/** 输入范围 */
|
|
131
|
+
inputRange: {
|
|
132
|
+
min: number;
|
|
133
|
+
max: number;
|
|
134
|
+
};
|
|
135
|
+
/** 流动速度范围(px/s) */
|
|
136
|
+
speedRange: {
|
|
137
|
+
min: number;
|
|
138
|
+
max: number;
|
|
139
|
+
};
|
|
140
|
+
/** 虚线图案长度 */
|
|
141
|
+
dashLength?: number;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* 透明度 参数
|
|
145
|
+
*/
|
|
146
|
+
export interface ValueOpacityParams {
|
|
147
|
+
type: AnimationTemplateType.VALUE_OPACITY;
|
|
148
|
+
/** 输入范围 */
|
|
149
|
+
inputRange: {
|
|
150
|
+
min: number;
|
|
151
|
+
max: number;
|
|
152
|
+
};
|
|
153
|
+
/** 输出透明度范围 */
|
|
154
|
+
outputRange: {
|
|
155
|
+
min: number;
|
|
156
|
+
max: number;
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* 字符串 → 文本内容 参数
|
|
161
|
+
*/
|
|
162
|
+
export interface ValueTextParams {
|
|
163
|
+
type: AnimationTemplateType.VALUE_TEXT;
|
|
164
|
+
/** 默认文本(空值时显示) */
|
|
165
|
+
defaultText?: string;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* 自定义参数
|
|
169
|
+
*/
|
|
170
|
+
export interface CustomParams {
|
|
171
|
+
type: AnimationTemplateType.CUSTOM;
|
|
172
|
+
/** 自定义映射函数(序列化的函数体) */
|
|
173
|
+
mappingFunction?: string;
|
|
174
|
+
/** 其他自定义配置 */
|
|
175
|
+
[key: string]: any;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* SVG 组件元数据(扩展标准 ComponentMetadata)
|
|
179
|
+
*/
|
|
180
|
+
export interface SVGComponentMetadata {
|
|
181
|
+
/** 组件 ID */
|
|
182
|
+
id: string;
|
|
183
|
+
/** 组件名称 */
|
|
184
|
+
name: string;
|
|
185
|
+
/** 组件分类 */
|
|
186
|
+
category: 'basic' | 'iot' | 'chart' | 'custom';
|
|
187
|
+
/** 图标 */
|
|
188
|
+
icon: string;
|
|
189
|
+
/** 描述 */
|
|
190
|
+
description?: string;
|
|
191
|
+
/** 版本 */
|
|
192
|
+
version?: string;
|
|
193
|
+
/** 作者 */
|
|
194
|
+
author?: string;
|
|
195
|
+
/** SVG 来源信息 */
|
|
196
|
+
svgSource?: {
|
|
197
|
+
/** 原始文件名 */
|
|
198
|
+
fileName?: string;
|
|
199
|
+
/** 上传时间 */
|
|
200
|
+
uploadTime?: string;
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* SVG 组件配置(完整)
|
|
205
|
+
*/
|
|
206
|
+
export interface SVGComponentConfig {
|
|
207
|
+
/** 元数据 */
|
|
208
|
+
metadata: SVGComponentMetadata;
|
|
209
|
+
/** 组件尺寸 */
|
|
210
|
+
size: {
|
|
211
|
+
width: number;
|
|
212
|
+
height: number;
|
|
213
|
+
};
|
|
214
|
+
/** SVG 内容(清理后的 SVG 字符串,去除 metadata 标签) */
|
|
215
|
+
svgContent: string;
|
|
216
|
+
/** 内部部件列表(自动提取 part-* 的元素) */
|
|
217
|
+
parts: SVGPart[];
|
|
218
|
+
/** 内部动画配置(可由组态工程师配置) */
|
|
219
|
+
internalAnimations?: InternalAnimationConfig[];
|
|
220
|
+
/** 默认数据(包含默认驱动字段) */
|
|
221
|
+
defaultData?: Record<string, any>;
|
|
222
|
+
/** 预设绑定(官方组件可提供) */
|
|
223
|
+
presetBindings?: Array<{
|
|
224
|
+
partId: string;
|
|
225
|
+
/** 驱动字段英文名(用于 data.xxx 字段) */
|
|
226
|
+
suggestedDriverProperty: string;
|
|
227
|
+
suggestedTemplate: AnimationTemplateType;
|
|
228
|
+
suggestedParams?: AnimationTemplateParams;
|
|
229
|
+
/** 可选:属性中文名称,用于属性面板显示 */
|
|
230
|
+
label?: string;
|
|
231
|
+
/** 可选:字段值类型,用于属性编辑器渲染 */
|
|
232
|
+
valueType?: 'number' | 'boolean' | 'string';
|
|
233
|
+
/** 如果是布尔型,可配置备选值列表(如 0/1, open/closed 等) */
|
|
234
|
+
booleanOptions?: Array<{
|
|
235
|
+
value: string | number | boolean;
|
|
236
|
+
label: string;
|
|
237
|
+
}>;
|
|
238
|
+
}>;
|
|
239
|
+
/** 接线柱配置(从 SVG 文件的 metadata 中读取) */
|
|
240
|
+
ports?: Array<{
|
|
241
|
+
id: string;
|
|
242
|
+
group: 'top' | 'bottom' | 'left' | 'right';
|
|
243
|
+
args?: {
|
|
244
|
+
x?: number | string;
|
|
245
|
+
y?: number | string;
|
|
246
|
+
};
|
|
247
|
+
}>;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* SVG 文件元数据格式(在 SVG 的 <metadata> 中)
|
|
251
|
+
*/
|
|
252
|
+
export interface SVGFileMetadata {
|
|
253
|
+
/** 组件元数据 */
|
|
254
|
+
component: {
|
|
255
|
+
id: string;
|
|
256
|
+
name: string;
|
|
257
|
+
category?: string;
|
|
258
|
+
icon?: string;
|
|
259
|
+
description?: string;
|
|
260
|
+
version?: string;
|
|
261
|
+
author?: string;
|
|
262
|
+
};
|
|
263
|
+
/** 默认尺寸 */
|
|
264
|
+
size?: {
|
|
265
|
+
width: number;
|
|
266
|
+
height: number;
|
|
267
|
+
};
|
|
268
|
+
/** 预设绑定(可选,官方组件提供) */
|
|
269
|
+
presetBindings?: Array<{
|
|
270
|
+
partId: string;
|
|
271
|
+
/** 驱动字段英文名(用于 data.xxx 字段) */
|
|
272
|
+
suggestedDriverProperty: string;
|
|
273
|
+
suggestedTemplate: AnimationTemplateType;
|
|
274
|
+
suggestedParams?: any;
|
|
275
|
+
/** 可选:属性中文名称,用于属性面板显示 */
|
|
276
|
+
label?: string;
|
|
277
|
+
/** 可选:字段值类型,用于属性编辑器渲染 */
|
|
278
|
+
valueType?: 'number' | 'boolean' | 'string';
|
|
279
|
+
/** 如果是布尔型,可配置备选值列表(如 0/1, open/closed 等) */
|
|
280
|
+
booleanOptions?: Array<{
|
|
281
|
+
value: string | number | boolean;
|
|
282
|
+
label: string;
|
|
283
|
+
}>;
|
|
284
|
+
}>;
|
|
285
|
+
/** 接线柱配置(可选) */
|
|
286
|
+
ports?: Array<{
|
|
287
|
+
/** 接线柱 ID */
|
|
288
|
+
id: string;
|
|
289
|
+
/** 位置组 */
|
|
290
|
+
group: 'top' | 'bottom' | 'left' | 'right';
|
|
291
|
+
/** 自定义位置(可选,覆盖 group 的默认位置) */
|
|
292
|
+
args?: {
|
|
293
|
+
x?: number | string;
|
|
294
|
+
y?: number | string;
|
|
295
|
+
};
|
|
296
|
+
}>;
|
|
297
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SVG 组件系统演示和测试
|
|
3
|
+
* 在浏览器控制台运行以下代码进行测试
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* 演示1:加载示例 SVG 组件
|
|
7
|
+
*/
|
|
8
|
+
export declare function demo1_loadExamples(): Promise<void>;
|
|
9
|
+
/**
|
|
10
|
+
* 演示2:从字符串加载自定义 SVG
|
|
11
|
+
*/
|
|
12
|
+
export declare function demo2_loadCustomSvg(): void;
|
|
13
|
+
/**
|
|
14
|
+
* 演示3:配置内部动画
|
|
15
|
+
*/
|
|
16
|
+
export declare function demo3_configureAnimation(nodeId: string): void;
|
|
17
|
+
/**
|
|
18
|
+
* 演示4:模拟数据驱动动画
|
|
19
|
+
*/
|
|
20
|
+
export declare function demo4_simulateDataDrive(): void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { AnimationTemplateType } from '../core/types';
|
|
2
|
+
/**
|
|
3
|
+
* 从目录批量加载示例 SVG 组件
|
|
4
|
+
*/
|
|
5
|
+
export declare function loadExampleSvgComponents(): Promise<void>;
|
|
6
|
+
/**
|
|
7
|
+
* 获取动画模板的友好名称
|
|
8
|
+
*/
|
|
9
|
+
export declare function getAnimationTemplateName(templateType: AnimationTemplateType): string;
|
|
10
|
+
/**
|
|
11
|
+
* 获取动画模板的描述
|
|
12
|
+
*/
|
|
13
|
+
export declare function getAnimationTemplateDescription(templateType: AnimationTemplateType): string;
|
|
14
|
+
/**
|
|
15
|
+
* 创建默认的动画模板参数
|
|
16
|
+
*/
|
|
17
|
+
export declare function createDefaultTemplateParams(templateType: AnimationTemplateType): any;
|
|
18
|
+
/**
|
|
19
|
+
* 验证内部动画配置
|
|
20
|
+
*/
|
|
21
|
+
export declare function validateInternalAnimation(config: any): {
|
|
22
|
+
valid: boolean;
|
|
23
|
+
errors: string[];
|
|
24
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SVG 组件系统统一导出
|
|
3
|
+
*/
|
|
4
|
+
export * from './core/types';
|
|
5
|
+
export { SVGParser } from './core/parser';
|
|
6
|
+
export { svgLoader, SVGLoader } from './core/loader';
|
|
7
|
+
export { animationTemplateEngine, AnimationTemplateEngine } from './rendering/animationTemplates';
|
|
8
|
+
export { default as SVGRenderer } from './rendering/SVGRenderer';
|
|
9
|
+
export { loadExampleSvgComponents, getAnimationTemplateName, getAnimationTemplateDescription, createDefaultTemplateParams, validateInternalAnimation } from './helpers/utils';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { SVGComponentConfig } from '../core/types';
|
|
2
|
+
/**
|
|
3
|
+
* Props
|
|
4
|
+
*/
|
|
5
|
+
interface Props {
|
|
6
|
+
/** X6 节点对象 */
|
|
7
|
+
node?: any;
|
|
8
|
+
/** SVG 组件配置(从解析器来) */
|
|
9
|
+
config?: SVGComponentConfig;
|
|
10
|
+
}
|
|
11
|
+
declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
12
|
+
svgRef: HTMLDivElement;
|
|
13
|
+
}, HTMLDivElement>;
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { AnimationTemplateType, AnimationTemplateParams } from '../core/types';
|
|
2
|
+
/**
|
|
3
|
+
* 动画模板引擎类
|
|
4
|
+
*/
|
|
5
|
+
export declare class AnimationTemplateEngine {
|
|
6
|
+
private states;
|
|
7
|
+
/**
|
|
8
|
+
* 应用动画模板
|
|
9
|
+
* @param element SVG 元素
|
|
10
|
+
* @param templateType 模板类型
|
|
11
|
+
* @param params 模板参数
|
|
12
|
+
* @param driverValue 驱动值(来自 node.data)
|
|
13
|
+
* @param options 动画选项
|
|
14
|
+
*/
|
|
15
|
+
applyTemplate(element: SVGGraphicsElement, templateType: AnimationTemplateType, params: AnimationTemplateParams, driverValue: any, options?: {
|
|
16
|
+
transitionDuration?: number;
|
|
17
|
+
easing?: string;
|
|
18
|
+
stateKey?: string;
|
|
19
|
+
}): void;
|
|
20
|
+
/**
|
|
21
|
+
* 开度 → 旋转
|
|
22
|
+
*/
|
|
23
|
+
private applyOpeningRotate;
|
|
24
|
+
/**
|
|
25
|
+
* 液位 → 高度
|
|
26
|
+
*/
|
|
27
|
+
private applyLevelHeight;
|
|
28
|
+
/**
|
|
29
|
+
* 对矩形应用液位
|
|
30
|
+
*/
|
|
31
|
+
private applyLevelToRect;
|
|
32
|
+
/**
|
|
33
|
+
* 对路径应用液位(使用 clip-path)
|
|
34
|
+
*/
|
|
35
|
+
private applyLevelToPath;
|
|
36
|
+
/**
|
|
37
|
+
* 使用 clip-path 应用液位
|
|
38
|
+
*/
|
|
39
|
+
private applyLevelWithClipPath;
|
|
40
|
+
/**
|
|
41
|
+
* 状态 → 颜色
|
|
42
|
+
*/
|
|
43
|
+
private applyStatusColor;
|
|
44
|
+
/**
|
|
45
|
+
* 数值 → 位置
|
|
46
|
+
*/
|
|
47
|
+
private applyValuePosition;
|
|
48
|
+
/**
|
|
49
|
+
* 速度 → 流动
|
|
50
|
+
*/
|
|
51
|
+
private applySpeedFlow;
|
|
52
|
+
/**
|
|
53
|
+
* 透明度映射
|
|
54
|
+
*/
|
|
55
|
+
private applyValueOpacity;
|
|
56
|
+
/**
|
|
57
|
+
* 字符串 → 文本内容
|
|
58
|
+
*/
|
|
59
|
+
private applyValueText;
|
|
60
|
+
/**
|
|
61
|
+
* 值映射(线性插值)
|
|
62
|
+
*/
|
|
63
|
+
private mapRange;
|
|
64
|
+
/**
|
|
65
|
+
* 获取变换原点
|
|
66
|
+
*/
|
|
67
|
+
private getTransformOrigin;
|
|
68
|
+
/**
|
|
69
|
+
* 确保流动动画的 CSS 已定义
|
|
70
|
+
*/
|
|
71
|
+
private ensureFlowAnimation;
|
|
72
|
+
/**
|
|
73
|
+
* 清理状态
|
|
74
|
+
*/
|
|
75
|
+
clearState(stateKey: string): void;
|
|
76
|
+
/**
|
|
77
|
+
* 清理所有状态
|
|
78
|
+
*/
|
|
79
|
+
clearAllStates(): void;
|
|
80
|
+
}
|
|
81
|
+
export declare const animationTemplateEngine: AnimationTemplateEngine;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 3D 模型相关类型定义
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* 3D 向量
|
|
6
|
+
*/
|
|
7
|
+
export interface Vector3 {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
z: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* 3D 模型来源类型
|
|
14
|
+
*/
|
|
15
|
+
export type Model3DType = 'procedural' | 'gltf' | 'glb' | 'fbx';
|
|
16
|
+
/**
|
|
17
|
+
* 3D 模型配置(组件级别)
|
|
18
|
+
*/
|
|
19
|
+
export interface Model3DConfig {
|
|
20
|
+
/** 模型类型 */
|
|
21
|
+
type: Model3DType;
|
|
22
|
+
/** 模型文件 URL 或 Blob URL */
|
|
23
|
+
source?: string;
|
|
24
|
+
/** 默认缩放 */
|
|
25
|
+
scale?: number;
|
|
26
|
+
/** 初始位置 */
|
|
27
|
+
position?: Vector3;
|
|
28
|
+
/** 初始旋转(弧度) */
|
|
29
|
+
rotation?: Vector3;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* 已加载模型的元数据
|
|
33
|
+
*/
|
|
34
|
+
export interface ModelMetadata {
|
|
35
|
+
/** 顶点数 */
|
|
36
|
+
vertexCount: number;
|
|
37
|
+
/** 材质数 */
|
|
38
|
+
materialCount: number;
|
|
39
|
+
/** 包围盒 */
|
|
40
|
+
boundingBox: {
|
|
41
|
+
min: Vector3;
|
|
42
|
+
max: Vector3;
|
|
43
|
+
};
|
|
44
|
+
/** 是否包含动画 */
|
|
45
|
+
hasAnimations: boolean;
|
|
46
|
+
/** 动画名称列表 */
|
|
47
|
+
animationNames: string[];
|
|
48
|
+
/** 文件大小(bytes) */
|
|
49
|
+
fileSize?: number;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* 加载后的模型数据
|
|
53
|
+
*/
|
|
54
|
+
export interface LoadedModel {
|
|
55
|
+
/** Three.js Object3D 实例 */
|
|
56
|
+
object3D: any;
|
|
57
|
+
/** 模型元数据 */
|
|
58
|
+
metadata: ModelMetadata;
|
|
59
|
+
/** 动画片段列表 */
|
|
60
|
+
animations: any[];
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* 标准化后的模型
|
|
64
|
+
*/
|
|
65
|
+
export interface NormalizedModel extends LoadedModel {
|
|
66
|
+
/** 标准化缩放因子(已应用) */
|
|
67
|
+
normalizeScale: number;
|
|
68
|
+
/** 原始包围盒中心偏移(已应用) */
|
|
69
|
+
centerOffset: Vector3;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* 模型缓存条目
|
|
73
|
+
*/
|
|
74
|
+
export interface ModelCacheEntry {
|
|
75
|
+
/** 缓存键 */
|
|
76
|
+
key: string;
|
|
77
|
+
/** 已加载的模型 */
|
|
78
|
+
model: LoadedModel;
|
|
79
|
+
/** 最后访问时间戳 */
|
|
80
|
+
lastAccess: number;
|
|
81
|
+
/** 文件大小(bytes) */
|
|
82
|
+
size: number;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* 3D 场景配置
|
|
86
|
+
*/
|
|
87
|
+
export interface Scene3DConfig {
|
|
88
|
+
/** 背景色 */
|
|
89
|
+
backgroundColor?: string;
|
|
90
|
+
/** 环境光强度 (0-1) */
|
|
91
|
+
ambientLightIntensity?: number;
|
|
92
|
+
/** 主光源强度 (0-1) */
|
|
93
|
+
directionalLightIntensity?: number;
|
|
94
|
+
/** 是否启用阴影 */
|
|
95
|
+
enableShadows?: boolean;
|
|
96
|
+
/** 是否启用抗锯齿 */
|
|
97
|
+
antialias?: boolean;
|
|
98
|
+
/** 相机初始位置 */
|
|
99
|
+
cameraPosition?: Vector3;
|
|
100
|
+
/** 相机观察目标 */
|
|
101
|
+
cameraTarget?: Vector3;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* 默认3D场景配置
|
|
105
|
+
*/
|
|
106
|
+
export declare const defaultScene3DConfig: Scene3DConfig;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 分区系统类型定义
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* 分区布局模式
|
|
6
|
+
*/
|
|
7
|
+
export type ZoneLayoutMode = 'single-2d' | 'horizontal' | 'vertical';
|
|
8
|
+
/**
|
|
9
|
+
* 分区布局配置
|
|
10
|
+
*/
|
|
11
|
+
export interface ZoneLayoutConfig {
|
|
12
|
+
/** 布局模式: single-2d(仅2D) / horizontal(左右分屏) / vertical(上下分屏) */
|
|
13
|
+
mode: ZoneLayoutMode;
|
|
14
|
+
/** 2D区域占比 (0.3 - 0.7),默认 0.5 */
|
|
15
|
+
splitRatio: number;
|
|
16
|
+
/** 区域最小尺寸(px),默认 300 */
|
|
17
|
+
minZoneSize: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* 默认分区布局配置
|
|
21
|
+
*/
|
|
22
|
+
export declare const defaultZoneLayoutConfig: ZoneLayoutConfig;
|
|
23
|
+
/**
|
|
24
|
+
* 区域类型标识
|
|
25
|
+
*/
|
|
26
|
+
export type ZoneType = '2d' | '3d';
|
|
27
|
+
/**
|
|
28
|
+
* 跨区域事件类型定义
|
|
29
|
+
*/
|
|
30
|
+
export interface ZoneEvents {
|
|
31
|
+
/** 组件被选中 */
|
|
32
|
+
'component:selected': {
|
|
33
|
+
id: string;
|
|
34
|
+
source: ZoneType;
|
|
35
|
+
};
|
|
36
|
+
/** 组件取消选中 */
|
|
37
|
+
'component:deselected': {
|
|
38
|
+
source: ZoneType;
|
|
39
|
+
};
|
|
40
|
+
/** 组件数据更新 */
|
|
41
|
+
'data:updated': {
|
|
42
|
+
componentId: string;
|
|
43
|
+
data: Record<string, any>;
|
|
44
|
+
};
|
|
45
|
+
/** 布局模式变化 */
|
|
46
|
+
'layout:changed': {
|
|
47
|
+
mode: ZoneLayoutMode;
|
|
48
|
+
};
|
|
49
|
+
/** 组件被删除 */
|
|
50
|
+
'component:deleted': {
|
|
51
|
+
id: string;
|
|
52
|
+
source: ZoneType;
|
|
53
|
+
};
|
|
54
|
+
}
|