dcim-topology2d 1.1.6 → 3.0.2
Sign up to get free protection for your applications and to get access to all the features.
- package/activity-diagram/src/final/final.d.ts +1 -1
- package/activity-diagram/src/final/final.rect.d.ts +1 -1
- package/activity-diagram/src/final/final.rect.js +1 -1
- package/activity-diagram/src/fork/fork.anchor.d.ts +1 -1
- package/activity-diagram/src/fork/fork.anchor.js +1 -1
- package/activity-diagram/src/fork/fork.d.ts +1 -1
- package/activity-diagram/src/fork/fork.rect.d.ts +1 -1
- package/activity-diagram/src/fork/fork.rect.js +1 -1
- package/activity-diagram/src/register.js +1 -1
- package/activity-diagram/src/swimlaneH/swimlaneH.d.ts +1 -1
- package/activity-diagram/src/swimlaneH/swimlaneH.rect.d.ts +1 -1
- package/activity-diagram/src/swimlaneH/swimlaneH.rect.js +1 -1
- package/activity-diagram/src/swimlaneV/swimlaneV.d.ts +1 -1
- package/activity-diagram/src/swimlaneV/swimlaneV.rect.d.ts +1 -1
- package/activity-diagram/src/swimlaneV/swimlaneV.rect.js +1 -1
- package/chart-diagram/index.d.ts +0 -2
- package/chart-diagram/index.js +0 -1
- package/chart-diagram/src/echarts/index.d.ts +2 -1
- package/chart-diagram/src/echarts/index.js +104 -106
- package/chart-diagram/src/register.js +8 -9
- package/class-diagram/src/class/class.d.ts +1 -1
- package/class-diagram/src/class/class.rect.d.ts +1 -1
- package/class-diagram/src/class/class.rect.js +1 -1
- package/class-diagram/src/register.js +1 -1
- package/core/index.d.ts +0 -1
- package/core/index.js +0 -1
- package/core/src/activeLayer.d.ts +10 -2
- package/core/src/activeLayer.js +41 -42
- package/core/src/animateLayer.d.ts +7 -3
- package/core/src/animateLayer.js +12 -10
- package/core/src/calling.d.ts +4 -1
- package/core/src/calling.js +41 -43
- package/core/src/canvas.d.ts +6 -1
- package/core/src/canvas.js +18 -17
- package/core/src/common.d.ts +5 -5
- package/core/src/common.js +202 -172
- package/core/src/core.d.ts +4 -3
- package/core/src/core.js +321 -339
- package/core/src/divLayer.d.ts +33 -2
- package/core/src/divLayer.js +292 -41
- package/core/src/healps/changeData.d.ts +1 -1
- package/core/src/healps/changeData.js +44 -102
- package/core/src/hoverLayer.d.ts +9 -2
- package/core/src/hoverLayer.js +34 -31
- package/core/src/middles/default.d.ts +3 -1
- package/core/src/middles/default.js +51 -51
- package/core/src/middles/index.js +2 -3
- package/core/src/middles/nodes/pentagon.rect.js +1 -1
- package/core/src/middles/nodes/rectangle.rect.js +1 -1
- package/core/src/models/data.d.ts +26 -0
- package/core/src/models/data.js +77 -0
- package/core/src/models/data.js.map +1 -0
- package/core/src/models/index.d.ts +1 -0
- package/core/src/models/index.js +1 -0
- package/core/src/models/node.d.ts +0 -6
- package/core/src/models/node.js +16 -29
- package/core/src/models/pen.js +7 -16
- package/core/src/mqtt.d.ts +14 -0
- package/core/src/mqtt.js +82 -0
- package/core/src/mqtt.js.map +1 -0
- package/core/src/offscreen.d.ts +4 -1
- package/core/src/offscreen.js +8 -10
- package/core/src/options.js +0 -1
- package/core/src/poll.js +2 -0
- package/core/src/preview.d.ts +13 -1
- package/core/src/preview.js +34 -56
- package/core/src/renderLayer.d.ts +3 -1
- package/core/src/renderLayer.js +31 -26
- package/core/src/socket.d.ts +10 -0
- package/core/src/socket.js +51 -0
- package/core/src/socket.js.map +1 -0
- package/core/src/utils/canvas.js +1 -1
- package/core/src/utils/conversion.d.ts +0 -7
- package/core/src/utils/conversion.js +0 -54
- package/core/src/utils/dom.d.ts +5 -6
- package/core/src/utils/dom.js +46 -82
- package/core/src/utils/index.d.ts +0 -1
- package/core/src/utils/index.js +0 -1
- package/core/src/utils/onmousevent.js +3 -12
- package/flow-diagram/src/comment/comment.anchor.d.ts +1 -1
- package/flow-diagram/src/comment/comment.anchor.js +1 -1
- package/flow-diagram/src/comment/comment.d.ts +1 -1
- package/flow-diagram/src/data/data.anchor.d.ts +1 -1
- package/flow-diagram/src/data/data.anchor.js +1 -1
- package/flow-diagram/src/data/data.d.ts +1 -1
- package/flow-diagram/src/data/data.rect.d.ts +1 -1
- package/flow-diagram/src/data/data.rect.js +1 -1
- package/flow-diagram/src/db/db.d.ts +1 -1
- package/flow-diagram/src/db/db.rect.d.ts +1 -1
- package/flow-diagram/src/db/db.rect.js +1 -1
- package/flow-diagram/src/display/display.anchor.d.ts +1 -1
- package/flow-diagram/src/display/display.anchor.js +1 -1
- package/flow-diagram/src/display/display.d.ts +1 -1
- package/flow-diagram/src/display/display.rect.d.ts +1 -1
- package/flow-diagram/src/display/display.rect.js +1 -1
- package/flow-diagram/src/document/document.anchor.d.ts +1 -1
- package/flow-diagram/src/document/document.anchor.js +1 -1
- package/flow-diagram/src/document/document.d.ts +1 -1
- package/flow-diagram/src/document/document.rect.d.ts +1 -1
- package/flow-diagram/src/document/document.rect.js +1 -1
- package/flow-diagram/src/externStorage/externStorage.anchor.d.ts +1 -1
- package/flow-diagram/src/externStorage/externStorage.anchor.js +1 -1
- package/flow-diagram/src/externStorage/externStorage.d.ts +1 -1
- package/flow-diagram/src/externStorage/externStorage.rect.d.ts +1 -1
- package/flow-diagram/src/externStorage/externStorage.rect.js +1 -1
- package/flow-diagram/src/internalStorage/internalStorage.d.ts +1 -1
- package/flow-diagram/src/internalStorage/internalStorage.rect.d.ts +1 -1
- package/flow-diagram/src/internalStorage/internalStorage.rect.js +1 -1
- package/flow-diagram/src/manually/manually.anchor.d.ts +1 -1
- package/flow-diagram/src/manually/manually.anchor.js +1 -1
- package/flow-diagram/src/manually/manually.d.ts +1 -1
- package/flow-diagram/src/manually/manually.rect.d.ts +1 -1
- package/flow-diagram/src/manually/manually.rect.js +1 -1
- package/flow-diagram/src/parallel/parallel.anchor.d.ts +1 -1
- package/flow-diagram/src/parallel/parallel.anchor.js +1 -1
- package/flow-diagram/src/parallel/parallel.d.ts +1 -1
- package/flow-diagram/src/queue/queue.d.ts +1 -1
- package/flow-diagram/src/queue/queue.rect.d.ts +1 -1
- package/flow-diagram/src/queue/queue.rect.js +1 -1
- package/flow-diagram/src/register.js +1 -1
- package/flow-diagram/src/subprocess/subprocess.d.ts +1 -1
- package/flow-diagram/src/subprocess/subprocess.rect.d.ts +1 -1
- package/flow-diagram/src/subprocess/subprocess.rect.js +1 -1
- package/layout/src/align.d.ts +1 -1
- package/layout/src/align.js +1 -1
- package/layout/src/layout.d.ts +1 -1
- package/layout/src/layout.js +1 -1
- package/myShape-diagram/myShape.js +1 -1
- package/package.json +1 -1
- package/sequence-diagram/src/focus/focus.anchor.d.ts +1 -1
- package/sequence-diagram/src/focus/focus.anchor.js +1 -1
- package/sequence-diagram/src/focus/focus.d.ts +1 -1
- package/sequence-diagram/src/focus/focus.rect.d.ts +1 -1
- package/sequence-diagram/src/focus/focus.rect.js +1 -1
- package/sequence-diagram/src/lifeline/lifeline.anchor.d.ts +1 -1
- package/sequence-diagram/src/lifeline/lifeline.anchor.js +1 -1
- package/sequence-diagram/src/lifeline/lifeline.d.ts +1 -1
- package/sequence-diagram/src/lifeline/lifeline.rect.d.ts +1 -1
- package/sequence-diagram/src/lifeline/lifeline.rect.js +1 -1
- package/sequence-diagram/src/register.js +1 -1
- package/chart-diagram/src/utils/changeOptions.d.ts +0 -4
- package/chart-diagram/src/utils/changeOptions.js +0 -163
- package/chart-diagram/src/utils/conversion.d.ts +0 -17
- package/chart-diagram/src/utils/conversion.js +0 -179
- package/chart-diagram/src/utils/drawGraphic.d.ts +0 -3
- package/chart-diagram/src/utils/drawGraphic.js +0 -97
- package/chart-diagram/src/utils/index.d.ts +0 -3
- package/chart-diagram/src/utils/index.js +0 -3
- package/core/src/middles/arrows/index.d.ts +0 -4
- package/core/src/middles/arrows/index.js +0 -5
- package/core/src/middles/lines/index.d.ts +0 -4
- package/core/src/middles/lines/index.js +0 -5
- package/core/src/middles/nodes/iframe.d.ts +0 -2
- package/core/src/middles/nodes/iframe.js +0 -12
- package/core/src/middles/nodes/index.d.ts +0 -46
- package/core/src/middles/nodes/index.js +0 -47
- package/core/src/store/common.d.ts +0 -9
- package/core/src/store/common.js +0 -5
- package/core/src/store/data.d.ts +0 -129
- package/core/src/store/data.js +0 -86
- package/core/src/store/index.d.ts +0 -2
- package/core/src/store/index.js +0 -2
- package/core/src/utils/assignment.d.ts +0 -3
- package/core/src/utils/assignment.js +0 -69
- package/static/echartsDefaultData.js +0 -239
- package/static/echartsStore.js +0 -14
- package/static/index.js +0 -2
- package/style/index.css +0 -13
@@ -1,97 +0,0 @@
|
|
1
|
-
// 绘制柱子切面
|
2
|
-
export function drawGraphicShape(appearance) {
|
3
|
-
const offsetX = appearance.offsetX;
|
4
|
-
const offsetY = appearance.offsetY;
|
5
|
-
// 绘制左侧面
|
6
|
-
const CubeLeft = echarts.graphic.extendShape({
|
7
|
-
shape: {
|
8
|
-
x: 0,
|
9
|
-
y: 0,
|
10
|
-
},
|
11
|
-
buildPath: function (ctx, shape) {
|
12
|
-
// 会canvas的应该都能看得懂,shape是从custom传入的
|
13
|
-
const xAxisPoint = shape.xAxisPoint;
|
14
|
-
// console.log(shape);
|
15
|
-
const c0 = [shape.x, shape.y];
|
16
|
-
const c1 = [shape.x - offsetX, shape.y - offsetY];
|
17
|
-
const c2 = [xAxisPoint[0] - offsetX, xAxisPoint[1] - offsetY];
|
18
|
-
const c3 = [xAxisPoint[0], xAxisPoint[1]];
|
19
|
-
ctx.moveTo(c0[0], c0[1]).lineTo(c1[0], c1[1]).lineTo(c2[0], c2[1]).lineTo(c3[0], c3[1]).closePath();
|
20
|
-
},
|
21
|
-
});
|
22
|
-
// 绘制右侧面
|
23
|
-
const CubeRight = echarts.graphic.extendShape({
|
24
|
-
shape: {
|
25
|
-
x: 0,
|
26
|
-
y: 0,
|
27
|
-
},
|
28
|
-
buildPath: function (ctx, shape) {
|
29
|
-
const xAxisPoint = shape.xAxisPoint;
|
30
|
-
const c1 = [shape.x, shape.y];
|
31
|
-
const c2 = [xAxisPoint[0], xAxisPoint[1]];
|
32
|
-
const c3 = [xAxisPoint[0] + offsetX, xAxisPoint[1] - offsetY];
|
33
|
-
const c4 = [shape.x + offsetX, shape.y - offsetY];
|
34
|
-
ctx.moveTo(c1[0], c1[1]).lineTo(c2[0], c2[1]).lineTo(c3[0], c3[1]).lineTo(c4[0], c4[1]).closePath();
|
35
|
-
},
|
36
|
-
});
|
37
|
-
// 绘制顶面
|
38
|
-
const CubeTop = echarts.graphic.extendShape({
|
39
|
-
shape: {
|
40
|
-
x: 0,
|
41
|
-
y: 0,
|
42
|
-
},
|
43
|
-
buildPath: function (ctx, shape) {
|
44
|
-
const c1 = [shape.x, shape.y];
|
45
|
-
const c2 = [shape.x + offsetX, shape.y - offsetY]; //右点
|
46
|
-
const c3 = [shape.x, shape.y - offsetX];
|
47
|
-
const c4 = [shape.x - offsetX, shape.y - offsetY];
|
48
|
-
ctx.moveTo(c1[0], c1[1]).lineTo(c2[0], c2[1]).lineTo(c3[0], c3[1]).lineTo(c4[0], c4[1]).closePath();
|
49
|
-
},
|
50
|
-
});
|
51
|
-
return {
|
52
|
-
CubeLeft,
|
53
|
-
CubeRight,
|
54
|
-
CubeTop
|
55
|
-
}
|
56
|
-
}
|
57
|
-
// 线性渐变
|
58
|
-
export function graphicLinearGradient(nr, nb, nl, nt, colors) {
|
59
|
-
return new echarts.graphic.LinearGradient(nr, nb, nl, nt, colors);
|
60
|
-
}
|
61
|
-
export function setSeriesRenderGroup(appearance, api) {
|
62
|
-
const seriesRenderData = [];
|
63
|
-
const groupTypeData = ['CubeLeft', 'CubeRight', 'CubeTop'];
|
64
|
-
const location = api.coord([api.value(0), api.value(1)]);
|
65
|
-
for (let i = 0; i < groupTypeData.length; i++) {
|
66
|
-
const groupItem = groupTypeData[i];
|
67
|
-
const groupNode = {
|
68
|
-
type: groupItem,
|
69
|
-
shape: {
|
70
|
-
api,
|
71
|
-
xValue: api.value(0),
|
72
|
-
yValue: api.value(1),
|
73
|
-
x: location[0],
|
74
|
-
y: location[1],
|
75
|
-
xAxisPoint: api.coord([api.value(0), 0]),
|
76
|
-
}
|
77
|
-
};
|
78
|
-
if(i === groupTypeData.length - 1){
|
79
|
-
// 顶部切面颜色填充
|
80
|
-
groupNode.style = {
|
81
|
-
fill: appearance.seriesCubeTopColor
|
82
|
-
}
|
83
|
-
}else {
|
84
|
-
// 左右切面颜色填充
|
85
|
-
let fillColor = graphicLinearGradient(0, 0, 0, 1, appearance[`series${groupItem}Gradient`]);
|
86
|
-
const cubeColorLinear = appearance[`series${groupItem}Linear`];
|
87
|
-
if(!cubeColorLinear) {
|
88
|
-
fillColor = appearance[`series${groupItem}Color`];
|
89
|
-
}
|
90
|
-
groupNode.style = {
|
91
|
-
fill: fillColor
|
92
|
-
}
|
93
|
-
}
|
94
|
-
seriesRenderData.push(groupNode);
|
95
|
-
}
|
96
|
-
return seriesRenderData;
|
97
|
-
}
|
@@ -1,12 +0,0 @@
|
|
1
|
-
import {rectangle} from 'dcim-topology2d/core'
|
2
|
-
|
3
|
-
export function iframePrimeval(ctx, node) {
|
4
|
-
//console.log('iframePrimeval############', node)
|
5
|
-
// 绘制一个底图,类似于占位符。
|
6
|
-
rectangle(ctx, node);
|
7
|
-
if (!node.elementLoaded) {
|
8
|
-
// 添加当前节点到div层
|
9
|
-
node.addToDiv('init')
|
10
|
-
node.elementRendered = false
|
11
|
-
}
|
12
|
-
}
|
@@ -1,46 +0,0 @@
|
|
1
|
-
export * from './arbitrarygraph';
|
2
|
-
export * from './arbitrarygraph.anchor';
|
3
|
-
export * from './arrow';
|
4
|
-
export * from './arrow.rect';
|
5
|
-
export * from './arrow.anchor';
|
6
|
-
export * from './circle';
|
7
|
-
export * from './circle.rect';
|
8
|
-
export * from './circle.anchor';
|
9
|
-
export * from './cloud';
|
10
|
-
export * from './cloud.rect';
|
11
|
-
export * from './cloud.anchor';
|
12
|
-
export * from './cube';
|
13
|
-
export * from './cube.rect';
|
14
|
-
export * from './cube.anchor';
|
15
|
-
export * from './cube.model';
|
16
|
-
export * from './diamond';
|
17
|
-
export * from './diamond.rect';
|
18
|
-
export * from './file';
|
19
|
-
export * from './formtable';
|
20
|
-
export * from './hexagon';
|
21
|
-
export * from './hexagon.anchor';
|
22
|
-
export * from './hexagon.rect';
|
23
|
-
export * from './image.rect';
|
24
|
-
export * from './image.anchor';
|
25
|
-
export * from './iframe';
|
26
|
-
export * from './line';
|
27
|
-
export * from './line.anchor';
|
28
|
-
export * from './line.rect';
|
29
|
-
export * from './message';
|
30
|
-
export * from './message.anchor';
|
31
|
-
export * from './message.rect';
|
32
|
-
export * from './pentagon';
|
33
|
-
export * from './pentagon.anchor';
|
34
|
-
export * from './pentagon.rect';
|
35
|
-
export * from './pentagram';
|
36
|
-
export * from './pentagram.anchor';
|
37
|
-
export * from './pentagram.rect';
|
38
|
-
export * from './people';
|
39
|
-
export * from './people.rect';
|
40
|
-
export * from './rectangle';
|
41
|
-
export * from './rectangle.rect';
|
42
|
-
export * from './tablePagination';
|
43
|
-
export * from './text';
|
44
|
-
export * from './triangle';
|
45
|
-
export * from './triangle.anchor';
|
46
|
-
export * from './triangle.rect';
|
@@ -1,47 +0,0 @@
|
|
1
|
-
export * from './arbitrarygraph';
|
2
|
-
export * from './arbitrarygraph.anchor';
|
3
|
-
export * from './arrow';
|
4
|
-
export * from './arrow.rect';
|
5
|
-
export * from './arrow.anchor';
|
6
|
-
export * from './circle';
|
7
|
-
export * from './circle.rect';
|
8
|
-
export * from './circle.anchor';
|
9
|
-
export * from './cloud';
|
10
|
-
export * from './cloud.rect';
|
11
|
-
export * from './cloud.anchor';
|
12
|
-
export * from './cube';
|
13
|
-
export * from './cube.rect';
|
14
|
-
export * from './cube.anchor';
|
15
|
-
export * from './cube.model';
|
16
|
-
export * from './diamond';
|
17
|
-
export * from './diamond.rect';
|
18
|
-
export * from './file';
|
19
|
-
export * from './formtable';
|
20
|
-
export * from './hexagon';
|
21
|
-
export * from './hexagon.anchor';
|
22
|
-
export * from './hexagon.rect';
|
23
|
-
export * from './image.rect';
|
24
|
-
export * from './image.anchor';
|
25
|
-
export * from './iframe';
|
26
|
-
export * from './line';
|
27
|
-
export * from './line.anchor';
|
28
|
-
export * from './line.rect';
|
29
|
-
export * from './message';
|
30
|
-
export * from './message.anchor';
|
31
|
-
export * from './message.rect';
|
32
|
-
export * from './pentagon';
|
33
|
-
export * from './pentagon.anchor';
|
34
|
-
export * from './pentagon.rect';
|
35
|
-
export * from './pentagram';
|
36
|
-
export * from './pentagram.anchor';
|
37
|
-
export * from './pentagram.rect';
|
38
|
-
export * from './people';
|
39
|
-
export * from './people.rect';
|
40
|
-
export * from './rectangle';
|
41
|
-
export * from './rectangle.rect';
|
42
|
-
export * from './tablePagination';
|
43
|
-
export * from './text';
|
44
|
-
export * from './triangle';
|
45
|
-
export * from './triangle.anchor';
|
46
|
-
export * from './triangle.rect';
|
47
|
-
//# sourceMappingURL=index.js.map
|
@@ -1,9 +0,0 @@
|
|
1
|
-
import { Pen } from '../models';
|
2
|
-
// @ts-ignore
|
3
|
-
export const commonStore: {
|
4
|
-
canvasDraws: {
|
5
|
-
[key: string]: (ctx: CanvasRenderingContext2D, pen: Pen) => void;
|
6
|
-
};
|
7
|
-
anchors: { [key: string]: (pen: Pen) => void };
|
8
|
-
htmlElements: { [key: string]: HTMLDivElement }; // html元素
|
9
|
-
};
|
package/core/src/store/common.js
DELETED
package/core/src/store/data.d.ts
DELETED
@@ -1,129 +0,0 @@
|
|
1
|
-
// @ts-ignore
|
2
|
-
import { default as mitt, Emitter } from 'mitt';
|
3
|
-
import { Pen, Lock } from '../models';
|
4
|
-
import {Options, DefalutOptions} from '../options';
|
5
|
-
import {s8} from '../utils';
|
6
|
-
import { commonStore } from './common'
|
7
|
-
// 2D可视化的data数据
|
8
|
-
export interface visualization2DData {
|
9
|
-
pens: Pen[];
|
10
|
-
lineName: string;
|
11
|
-
fromArrowType: string;
|
12
|
-
toArrowType: string;
|
13
|
-
scale: number;
|
14
|
-
locked: Lock;
|
15
|
-
bkImage: string;
|
16
|
-
bkColor: string;
|
17
|
-
grid?: boolean;
|
18
|
-
websocket?: string;
|
19
|
-
mqttUrl?: string;
|
20
|
-
mqttOptions?: {
|
21
|
-
clientId?: string;
|
22
|
-
username?: string;
|
23
|
-
password?: string;
|
24
|
-
};
|
25
|
-
mqttTopics?: string;
|
26
|
-
manualCps?: boolean;
|
27
|
-
dataConstruct?: any;
|
28
|
-
data?: any;
|
29
|
-
bkImageRect?: any;
|
30
|
-
}
|
31
|
-
// 2D可视化使用到的数据仓库
|
32
|
-
export interface visualization2DStore {
|
33
|
-
id: string;
|
34
|
-
data: visualization2DData;
|
35
|
-
pens: { [key: string]: Pen };
|
36
|
-
options: Options;
|
37
|
-
cacheDatas?: {
|
38
|
-
data: visualization2DData;
|
39
|
-
}[];
|
40
|
-
emitter: Emitter;
|
41
|
-
dpiRatio?: number;
|
42
|
-
lastScale?: number; //记录上次模版的scale
|
43
|
-
ratioCord: {
|
44
|
-
ratio?: number;
|
45
|
-
scaleX?: number;
|
46
|
-
scaleY?: number;
|
47
|
-
},
|
48
|
-
parentElem: HTMLElement
|
49
|
-
}
|
50
|
-
export interface mqttData {
|
51
|
-
data: null
|
52
|
-
}
|
53
|
-
export const syncMqttData: mqttData;
|
54
|
-
// @ts-ignore
|
55
|
-
export const createStore = () => {
|
56
|
-
return {
|
57
|
-
id: '',
|
58
|
-
data: {
|
59
|
-
pens: [],
|
60
|
-
lineName: 'curve',
|
61
|
-
fromArrowType: '',
|
62
|
-
toArrowType: 'triangleSolid',
|
63
|
-
scale: 1,
|
64
|
-
locked: Lock.None,
|
65
|
-
bkImageRect: null,
|
66
|
-
mqttOptions: {
|
67
|
-
clientId: s8()
|
68
|
-
},
|
69
|
-
dataConstruct: {}
|
70
|
-
},
|
71
|
-
pens: {},
|
72
|
-
options: { ...DefalutOptions },
|
73
|
-
emitter: mitt(),
|
74
|
-
cacheDatas: [],
|
75
|
-
dpiRatio: 1,
|
76
|
-
lastScale: 1,
|
77
|
-
ratioCord: {
|
78
|
-
ratio: 1,
|
79
|
-
scaleX: 1,
|
80
|
-
scaleY: 1
|
81
|
-
},
|
82
|
-
parentElem: null
|
83
|
-
} as visualization2DStore;
|
84
|
-
};
|
85
|
-
// @ts-ignore
|
86
|
-
export const useStore = (id = 'default'): visualization2DStore => {
|
87
|
-
if (!commonStore[id]) {
|
88
|
-
// @ts-ignore
|
89
|
-
commonStore[id] = createStore();
|
90
|
-
commonStore[id].id = id;
|
91
|
-
}
|
92
|
-
return commonStore[id];
|
93
|
-
};
|
94
|
-
|
95
|
-
// @ts-ignore
|
96
|
-
export const clearStore = (store: visualization2DStore) => {
|
97
|
-
store.data = {
|
98
|
-
bkColor: '',
|
99
|
-
bkImage: '',
|
100
|
-
data: undefined,
|
101
|
-
grid: false,
|
102
|
-
manualCps: false,
|
103
|
-
mqttTopics: '',
|
104
|
-
mqttUrl: '',
|
105
|
-
websocket: '',
|
106
|
-
pens: [],
|
107
|
-
lineName: 'curve',
|
108
|
-
fromArrowType: '',
|
109
|
-
toArrowType: 'triangleSolid',
|
110
|
-
scale: 1,
|
111
|
-
locked: Lock.None,
|
112
|
-
bkImageRect: null,
|
113
|
-
mqttOptions: {
|
114
|
-
clientId: s8()
|
115
|
-
},
|
116
|
-
dataConstruct: {}
|
117
|
-
};
|
118
|
-
store.lastScale = store.data.scale;
|
119
|
-
store.pens = {};
|
120
|
-
store.options = {};
|
121
|
-
store.cacheDatas = [];
|
122
|
-
store.dpiRatio = 1;
|
123
|
-
store.lastScale = 1;
|
124
|
-
store.ratioCord = {
|
125
|
-
ratio: 1,
|
126
|
-
scaleX: 1,
|
127
|
-
scaleY: 1
|
128
|
-
}
|
129
|
-
};
|
package/core/src/store/data.js
DELETED
@@ -1,86 +0,0 @@
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
2
|
-
__assign = Object.assign || function(t) {
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
4
|
-
s = arguments[i];
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
6
|
-
t[p] = s[p];
|
7
|
-
}
|
8
|
-
return t;
|
9
|
-
};
|
10
|
-
return __assign.apply(this, arguments);
|
11
|
-
};
|
12
|
-
import { default as mitt } from 'mitt';
|
13
|
-
import { Lock } from '../models';
|
14
|
-
import {DefalutOptions} from '../options';
|
15
|
-
import {s8} from '../utils';
|
16
|
-
import { commonStore } from './common'
|
17
|
-
export const syncMqttData = {
|
18
|
-
data: null
|
19
|
-
}
|
20
|
-
export var createStore = function () {
|
21
|
-
return {
|
22
|
-
id: '',
|
23
|
-
data: {
|
24
|
-
pens: [],
|
25
|
-
lineName: 'curve',
|
26
|
-
fromArrowType: '',
|
27
|
-
toArrowType: 'triangleSolid',
|
28
|
-
scale: 1,
|
29
|
-
locked: Lock.None,
|
30
|
-
dataResize: 1, // 数据是否加载,1是,0否
|
31
|
-
bkImageRect: null,
|
32
|
-
mqttOptions: {
|
33
|
-
clientId: s8()
|
34
|
-
},
|
35
|
-
dataConstruct: {}
|
36
|
-
},
|
37
|
-
pens: {},
|
38
|
-
options: { ...DefalutOptions },
|
39
|
-
emitter: mitt(),
|
40
|
-
cacheDatas: [],
|
41
|
-
dpiRatio: 1,
|
42
|
-
lastScale: 1,
|
43
|
-
ratioCord: {
|
44
|
-
ratio: 1,
|
45
|
-
scaleX: 1,
|
46
|
-
scaleY: 1
|
47
|
-
},
|
48
|
-
parentElem: null
|
49
|
-
};
|
50
|
-
};
|
51
|
-
export var useStore = function (id) {
|
52
|
-
if (id === void 0) { id = 'default'; }
|
53
|
-
if (!commonStore[id]) {
|
54
|
-
commonStore[id] = createStore();
|
55
|
-
commonStore[id].id = id;
|
56
|
-
}
|
57
|
-
return commonStore[id];
|
58
|
-
};
|
59
|
-
export var clearStore = function (store, del) {
|
60
|
-
store.lastScale = store.data.scale;
|
61
|
-
store.data = {
|
62
|
-
pens: [],
|
63
|
-
lineName: 'curve',
|
64
|
-
fromArrowType: '',
|
65
|
-
toArrowType: 'triangleSolid',
|
66
|
-
scale: 1,
|
67
|
-
locked: Lock.None,
|
68
|
-
dataResize: 1, // 数据是否加载,1是,0否
|
69
|
-
bkImageRect: null,
|
70
|
-
mqttOptions: {
|
71
|
-
clientId: s8()
|
72
|
-
},
|
73
|
-
dataConstruct: {}
|
74
|
-
};
|
75
|
-
store.pens = {};
|
76
|
-
store.cacheDatas = [];
|
77
|
-
store.dpiRatio = 1;
|
78
|
-
store.lastScale = 1;
|
79
|
-
store.ratioCord = {
|
80
|
-
ratio: 1,
|
81
|
-
scaleX: 1,
|
82
|
-
scaleY: 1
|
83
|
-
};
|
84
|
-
syncMqttData.data = null;
|
85
|
-
if(del) delete commonStore[store.id];
|
86
|
-
};
|
package/core/src/store/index.js
DELETED
@@ -1,69 +0,0 @@
|
|
1
|
-
// 变量赋值操作
|
2
|
-
import {syncMqttData} from '../store';
|
3
|
-
import { setConfItemNode } from '../healps';
|
4
|
-
import { EventAction } from '../models';
|
5
|
-
export function setInitNodeDataValidat(node, TID) {
|
6
|
-
const syncData = syncMqttData.data;
|
7
|
-
if (node.children && node.children.length) {
|
8
|
-
node.children.map((_item) => {
|
9
|
-
node.TID = TID;
|
10
|
-
setDefaultColorValidat(node);
|
11
|
-
setDefaultNodeValidat(node, syncData);
|
12
|
-
})
|
13
|
-
}else {
|
14
|
-
node.TID = TID;
|
15
|
-
setDefaultColorValidat(node);
|
16
|
-
setDefaultNodeValidat(node, syncData);
|
17
|
-
}
|
18
|
-
}
|
19
|
-
export function setDefaultColorValidat(node) {
|
20
|
-
node.defaultFillStyle = node.fillStyle;
|
21
|
-
node.defaultFontColor = node.font.color;
|
22
|
-
if (node.name === 'line') {
|
23
|
-
node.defaultStrokeStyle = node.font.color;
|
24
|
-
}
|
25
|
-
}
|
26
|
-
export function setDefaultNodeValidat(node, retData) {
|
27
|
-
//const item = JSON.parse(JSON.stringify(node));
|
28
|
-
if (!node.data || !retData) return;
|
29
|
-
//const node = detailData.length > 0 ? detailData : syncData
|
30
|
-
const functionData = node.events.filter((ev) => {
|
31
|
-
return ev.action === EventAction.Function
|
32
|
-
})
|
33
|
-
const dataValue = functionData[0]
|
34
|
-
if (functionData.length > 0 && dataValue.value && retData) {
|
35
|
-
node.data.map((d) => {
|
36
|
-
const {kpiData, tagData} = retData;
|
37
|
-
const key = d.key;
|
38
|
-
const value = d.value;
|
39
|
-
const _syncItem = key === 'tagId' ? tagData[value] : kpiData[value];
|
40
|
-
if ((key === 'tagId' || key === 'kpiAddr') && _syncItem) {
|
41
|
-
const isControl = parseInt(_syncItem.isControlDis); // 是否可控,0可控,1不可控
|
42
|
-
if (!isControl) {
|
43
|
-
d.tagVal = value
|
44
|
-
d.controlParams = _syncItem
|
45
|
-
// delete _syncItem[value]
|
46
|
-
// Object.assign(d, _syncItem)
|
47
|
-
}
|
48
|
-
}
|
49
|
-
})
|
50
|
-
// console.log('定制函数=====')
|
51
|
-
try {
|
52
|
-
const func = new Function('pen', 'params', dataValue.value)
|
53
|
-
func(node, JSON.stringify(retData))
|
54
|
-
}catch (e) {
|
55
|
-
console.log(`自定义函数 ${node.id} 出错>>>`, e);
|
56
|
-
}
|
57
|
-
} else {
|
58
|
-
// console.log('默认函数')
|
59
|
-
setConfItemNode(node, retData);
|
60
|
-
}
|
61
|
-
if (node.animateFrames && node.animateFrames.length) {
|
62
|
-
for (var _a = 0, _af = node.animateFrames; _a < _af.length; _a++) {
|
63
|
-
var ani = _af[_a];
|
64
|
-
ani.state.strokeStyle = node.strokeStyle;
|
65
|
-
ani.state.fillStyle = node.fillStyle;
|
66
|
-
}
|
67
|
-
}
|
68
|
-
//return node;
|
69
|
-
}
|