topo-engine 0.1.7 → 0.1.8
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 +19 -0
- package/dist/index.d.ts +7 -0
- package/dist/topo-engine.cjs +475 -80
- package/dist/topo-engine.cjs.map +1 -1
- package/dist/topo-engine.js +475 -80
- package/dist/topo-engine.js.map +1 -1
- package/dist/topo-engine.umd.cjs +475 -80
- package/dist/topo-engine.umd.cjs.map +1 -1
- package/docs/API.md +112 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
- 📐 **自研正交布局** — 主干沿最长路径横向铺开 + 分支带垂直直走,整图**横平竖直、0 交叉、0 重叠**,边缘路由为直线 / L 形折线
|
|
12
12
|
- 🔍 **拓扑查询 API** — 节点 / 边 / 邻居 / 子树 / 主干链 / 路径 / 坐标 查询
|
|
13
13
|
- 🎨 **样式控制** — 节点、边样式覆盖与批量重置
|
|
14
|
+
- 🎨 **节点 / 电表染色** — 按 **psrId(设备编码)** 染普通节点、按 **assetNo(资产编号)** 染计量箱内电表户(状态色、告警色场景)
|
|
14
15
|
- ✨ **动画与高亮** — 节点脉动、边流动、路径高亮、其余变暗、异常标注
|
|
15
16
|
- 📝 **文字标注** — 附加文字、用户名 full / short / hidden 切换
|
|
16
17
|
- 🃏 **卡片盒** — 节点信息卡片(字段 + 按钮),适配"运行曲线/工单跳转"类场景
|
|
@@ -282,6 +283,24 @@ const dataUrl = ref('/data/topology.json');
|
|
|
282
283
|
`setNodeStyle(id, style)`、`batchSetNodeStyle(ids, style)`、`resetNodeStyle(id)`、`resetAllNodeStyles()`
|
|
283
284
|
`setEdgeStyle(src, tgt, style)`、`batchSetEdgeStyle([[src,tgt],…], style)`、`resetEdgeStyle(src, tgt)`
|
|
284
285
|
|
|
286
|
+
### 节点 / 箱内电表户染色(psrId / 资产编号)
|
|
287
|
+
|
|
288
|
+
```javascript
|
|
289
|
+
// 普通节点:按 psrId(设备编码)整图单色换装(主体/引线/描边换成该色,白字细节保留)
|
|
290
|
+
topo.setNodeColor('8ff4786d548a7073a2517297e801518ff456732f4d', '#FF0000');
|
|
291
|
+
// 箱内电表户:按资产编号(assetNo,兼容 consNo/consId)染该户电表图标 + 户名
|
|
292
|
+
topo.setNodeColor('4230010007008084768', '#FF6600');
|
|
293
|
+
// 批量(数组 / 对象数组 / ref→color 对象均可)
|
|
294
|
+
topo.batchSetNodeColor({ '8ff4…': '#FF0000', '4230…': '#FF6600' });
|
|
295
|
+
// 清除 / 查询
|
|
296
|
+
topo.resetNodeColor('4230010007008084768');
|
|
297
|
+
topo.resetAllNodeColors();
|
|
298
|
+
topo.getNodeColor('4230010007008084768'); // → { kind, id, color } | null
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
> 引用规则与 `addConnection` 一致:节点 id / **psrId** 命中普通节点;**assetNo** 命中计量箱内某户电表。
|
|
302
|
+
> 染色记录随主题切换 / 数据重渲染自动保留并重放(无需重新设置)。详见 [docs/API.md](docs/API.md)。
|
|
303
|
+
|
|
285
304
|
### 高亮 / 变暗
|
|
286
305
|
|
|
287
306
|
```javascript
|
package/dist/index.d.ts
CHANGED
|
@@ -43,6 +43,13 @@ export class TopoApi {
|
|
|
43
43
|
batchSetNodeStyle(nodeIds: string[], style: object): void;
|
|
44
44
|
resetNodeStyle(nodeId: string): void;
|
|
45
45
|
resetAllNodeStyles(): void;
|
|
46
|
+
|
|
47
|
+
// 节点 / 箱内电表户染色(ref:节点 id 或 psrId;电表户用客户 assetNo/consNo/consId)
|
|
48
|
+
setNodeColor(ref: string, color: string | null): boolean;
|
|
49
|
+
batchSetNodeColor(entries: any, color?: string): { total: number, ok: number, failed: Array<{ ref: string, reason: string }> };
|
|
50
|
+
resetNodeColor(ref: string): boolean;
|
|
51
|
+
resetAllNodeColors(): void;
|
|
52
|
+
getNodeColor(ref: string): { kind: 'node' | 'customer', id: string, index?: number, color: string | null } | null;
|
|
46
53
|
|
|
47
54
|
// 边样式
|
|
48
55
|
setEdgeStyle(srcId: string, tgtId: string, style: object): void;
|