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
package/core/src/renderLayer.js
CHANGED
@@ -13,20 +13,22 @@ var __extends = (this && this.__extends) || (function () {
|
|
13
13
|
})();
|
14
14
|
import { Store } from 'le5le-store';
|
15
15
|
import { Canvas } from './canvas';
|
16
|
-
import {
|
16
|
+
import {previewType} from './utils/construction'
|
17
17
|
//let isQttFillStyle = false;
|
18
18
|
var RenderLayer = /** @class */ (function (_super) {
|
19
19
|
__extends(RenderLayer, _super);
|
20
|
-
function RenderLayer(TID) {
|
20
|
+
function RenderLayer(parentElem, options, TID) {
|
21
21
|
//isQttFillStyle = false;
|
22
|
-
|
22
|
+
if (options === void 0) { options = {}; }
|
23
|
+
var _this = _super.call(this, parentElem, options, TID) || this;
|
24
|
+
_this.parentElem = parentElem;
|
25
|
+
_this.options = options;
|
23
26
|
_this.bkImgRect = null;
|
24
27
|
_this.initImage = false;
|
25
28
|
_this.coverType = 'container';
|
26
29
|
_this.bgRect = null;
|
27
30
|
_this.render = function () {
|
28
|
-
if(
|
29
|
-
if (commonStore[TID].data.bkImage && !_this.initImage) {
|
31
|
+
if (_this.data.bkImage && !_this.initImage) {
|
30
32
|
_this.loadBkImg(_this.render, 'pixi');
|
31
33
|
return;
|
32
34
|
}
|
@@ -35,8 +37,12 @@ var RenderLayer = /** @class */ (function (_super) {
|
|
35
37
|
}
|
36
38
|
var ctx = _this.canvas.getContext('2d');
|
37
39
|
ctx.clearRect(0, 0, _this.canvas.width, _this.canvas.height);
|
38
|
-
if (
|
39
|
-
|
40
|
+
// if (_this.data.pens && _this.data.pens.length > 0 && !isQttFillStyle) {
|
41
|
+
// _this.data.pens.map((penItem) => {penItem.defaultFillStyle = penItem.fillStyle;})
|
42
|
+
// isQttFillStyle = true;
|
43
|
+
// }
|
44
|
+
if (_this.data.bkColor) {
|
45
|
+
ctx.fillStyle = _this.data.bkColor;
|
40
46
|
ctx.fillRect(0, 0, _this.width, _this.height);
|
41
47
|
}
|
42
48
|
if (_this.bkImg && _this.bkImgRect) {
|
@@ -46,38 +52,34 @@ var RenderLayer = /** @class */ (function (_super) {
|
|
46
52
|
ctx.drawImage(_this.offscreen, 0, 0, _this.width, _this.height);
|
47
53
|
};
|
48
54
|
_this.offscreen = Store.get(_this.generateStoreKey('LT:offscreen'));
|
49
|
-
|
55
|
+
_this.parentElem.appendChild(_this.canvas);
|
50
56
|
return _this;
|
51
57
|
}
|
52
58
|
RenderLayer.prototype.scale = function (scale, center, w, h){
|
53
|
-
|
54
|
-
if(!commonStore || !commonStore[TID]) return;
|
55
|
-
const bkImage = commonStore[TID].data.bkImage;
|
56
|
-
const bkImageRect = commonStore[TID].data.bkImageRect;
|
57
|
-
if(!bkImage) return;
|
59
|
+
if(!this.data.bkImage) return;
|
58
60
|
if(!center) {
|
59
|
-
center = bkImageRect ? bkImageRect.center : this.bgRect.center;
|
61
|
+
center = this.data.bkImageRect ? this.data.bkImageRect.center : this.bgRect.center;
|
60
62
|
}
|
61
63
|
if (!w) {
|
62
64
|
w = scale;
|
63
|
-
if(bkImageRect) {
|
64
|
-
bkImageRect.x = center.x - (center.x - bkImageRect.x) * w;
|
65
|
+
if(this.data.bkImageRect) {
|
66
|
+
this.data.bkImageRect.x = center.x - (center.x - this.data.bkImageRect.x) * w;
|
65
67
|
}else {
|
66
68
|
this.bgRect.x = center.x - (center.x - this.bgRect.x) * w;
|
67
69
|
}
|
68
70
|
}
|
69
71
|
if (!h) {
|
70
72
|
h = scale;
|
71
|
-
if(bkImageRect){
|
72
|
-
bkImageRect.y = center.y - (center.y - bkImageRect.y) * h;
|
73
|
+
if(this.data.bkImageRect){
|
74
|
+
this.data.bkImageRect.y = center.y - (center.y - this.data.bkImageRect.y) * h;
|
73
75
|
}else {
|
74
76
|
this.bgRect.y = center.y - (center.y - this.bgRect.y) * h;
|
75
77
|
}
|
76
78
|
}
|
77
|
-
if(bkImageRect) {
|
78
|
-
bkImageRect.width *= w;
|
79
|
-
bkImageRect.height *= h;
|
80
|
-
this.bkImgRect = bkImageRect;
|
79
|
+
if(this.data.bkImageRect) {
|
80
|
+
this.data.bkImageRect.width *= w;
|
81
|
+
this.data.bkImageRect.height *= h;
|
82
|
+
this.bkImgRect = this.data.bkImageRect;
|
81
83
|
}else {
|
82
84
|
if(this.initImage) {
|
83
85
|
this.bgRect.width *= w;
|
@@ -88,13 +90,12 @@ var RenderLayer = /** @class */ (function (_super) {
|
|
88
90
|
};
|
89
91
|
RenderLayer.prototype.loadBkImg = function (cb, pixi) {
|
90
92
|
var _this = this;
|
91
|
-
|
92
|
-
if (!bkImage || this.initImage) {
|
93
|
+
if (!this.data.bkImage || this.initImage) {
|
93
94
|
return;
|
94
95
|
}
|
95
96
|
this.bkImg = new Image();
|
96
97
|
this.bkImg.crossOrigin = 'anonymous';
|
97
|
-
this.bkImg.src = bkImage;
|
98
|
+
this.bkImg.src = this.data.bkImage;
|
98
99
|
this.bkImg.onload = function () {
|
99
100
|
if(pixi && !_this.bkImgRect) {
|
100
101
|
_this.bkImgRectResize({width: _this.canvas.width, height: _this.canvas.height});
|
@@ -148,7 +149,7 @@ var RenderLayer = /** @class */ (function (_super) {
|
|
148
149
|
};
|
149
150
|
|
150
151
|
RenderLayer.prototype.bkImgRectResize = function (size) {
|
151
|
-
const bkImageRect =
|
152
|
+
const bkImageRect = this.data.bkImageRect;
|
152
153
|
if(!size) return;
|
153
154
|
if(bkImageRect) {
|
154
155
|
let x = bkImageRect.x ? Number(bkImageRect.x) : 0;
|
@@ -169,12 +170,16 @@ var RenderLayer = /** @class */ (function (_super) {
|
|
169
170
|
|
170
171
|
RenderLayer.prototype.destroy = function() {
|
171
172
|
|
173
|
+
this.data = null;
|
174
|
+
|
172
175
|
this.canvas = null;
|
173
176
|
|
174
177
|
this.render = null;
|
175
178
|
|
176
179
|
this.offscreen = null;
|
177
180
|
|
181
|
+
this.options = null;
|
182
|
+
|
178
183
|
}
|
179
184
|
return RenderLayer;
|
180
185
|
}(Canvas));
|
@@ -0,0 +1,51 @@
|
|
1
|
+
import { EventType } from './models';
|
2
|
+
var Socket = /** @class */ (function () {
|
3
|
+
function Socket(url, data) {
|
4
|
+
var _this = this;
|
5
|
+
this.url = url;
|
6
|
+
this.data = data;
|
7
|
+
this.onmessage = function (e) {
|
8
|
+
if (!_this.data.pens.length || !e || !e.data) {
|
9
|
+
return;
|
10
|
+
}
|
11
|
+
var msg;
|
12
|
+
try {
|
13
|
+
msg = JSON.parse(e.data);
|
14
|
+
}
|
15
|
+
catch (error) {
|
16
|
+
msg = e.data;
|
17
|
+
}
|
18
|
+
for (var _i = 0, _a = _this.data.pens; _i < _a.length; _i++) {
|
19
|
+
var item = _a[_i];
|
20
|
+
for (var _b = 0, _c = item.events; _b < _c.length; _b++) {
|
21
|
+
var event_1 = _c[_b];
|
22
|
+
if (event_1.type === EventType.WebSocket) {
|
23
|
+
if (event_1.name && event_1.name === msg.event) {
|
24
|
+
item.doSocketMqtt(event_1, msg.data, _this.socket);
|
25
|
+
}
|
26
|
+
else if (!event_1.name && msg) {
|
27
|
+
item.doSocketMqtt(event_1, msg, _this.socket);
|
28
|
+
}
|
29
|
+
}
|
30
|
+
}
|
31
|
+
}
|
32
|
+
};
|
33
|
+
this.init();
|
34
|
+
}
|
35
|
+
Socket.prototype.init = function () {
|
36
|
+
var _this = this;
|
37
|
+
this.socket = new WebSocket(this.url);
|
38
|
+
this.socket.onmessage = this.onmessage;
|
39
|
+
this.socket.onclose = function () {
|
40
|
+
console.log('Canvas websocket closed and reconneting...');
|
41
|
+
_this.init();
|
42
|
+
};
|
43
|
+
};
|
44
|
+
Socket.prototype.close = function () {
|
45
|
+
this.socket.onclose = null;
|
46
|
+
this.socket.close();
|
47
|
+
};
|
48
|
+
return Socket;
|
49
|
+
}());
|
50
|
+
export { Socket };
|
51
|
+
//# sourceMappingURL=socket.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"socket.js","sourceRoot":"","sources":["../../../packages/core/src/socket.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAgB,MAAM,UAAU,CAAC;AAEnD;IAEE,gBAAmB,GAAW,EAAS,IAAkB;QAAzD,iBAEC;QAFkB,QAAG,GAAH,GAAG,CAAQ;QAAS,SAAI,GAAJ,IAAI,CAAc;QAczD,cAAS,GAAG,UAAC,CAAe;YAC1B,IAAI,CAAC,KAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE;gBAC3C,OAAO;aACR;YAED,IAAI,GAAkC,CAAC;YACvC,IAAI;gBACF,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;aAC1B;YAAC,OAAO,KAAK,EAAE;gBACd,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC;aACd;YAED,KAAmB,UAAc,EAAd,KAAA,KAAI,CAAC,IAAI,CAAC,IAAI,EAAd,cAAc,EAAd,IAAc,EAAE;gBAA9B,IAAM,IAAI,SAAA;gBACb,KAAoB,UAAW,EAAX,KAAA,IAAI,CAAC,MAAM,EAAX,cAAW,EAAX,IAAW,EAAE;oBAA5B,IAAM,OAAK,SAAA;oBACd,IAAI,OAAK,CAAC,IAAI,KAAK,SAAS,CAAC,SAAS,EAAE;wBACtC,IAAI,OAAK,CAAC,IAAI,IAAI,OAAK,CAAC,IAAI,KAAK,GAAG,CAAC,KAAK,EAAE;4BAC1C,IAAI,CAAC,YAAY,CAAC,OAAK,EAAE,GAAG,CAAC,IAAI,EAAE,KAAI,CAAC,MAAM,CAAC,CAAC;yBACjD;6BAAM,IAAI,CAAC,OAAK,CAAC,IAAI,IAAI,GAAG,EAAE;4BAC7B,IAAI,CAAC,YAAY,CAAC,OAAK,EAAE,GAAG,EAAE,KAAI,CAAC,MAAM,CAAC,CAAC;yBAC5C;qBACF;iBACF;aACF;QACH,CAAC,CAAC;QApCA,IAAI,CAAC,IAAI,EAAE,CAAC;IACd,CAAC;IAED,qBAAI,GAAJ;QAAA,iBAQC;QAPC,IAAI,CAAC,MAAM,GAAG,IAAI,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACtC,IAAI,CAAC,MAAM,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QAEvC,IAAI,CAAC,MAAM,CAAC,OAAO,GAAG;YACpB,OAAO,CAAC,GAAG,CAAC,4CAA4C,CAAC,CAAC;YAC1D,KAAI,CAAC,IAAI,EAAE,CAAC;QACd,CAAC,CAAC;IACJ,CAAC;IA2BD,sBAAK,GAAL;QACE,IAAI,CAAC,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC;QAC3B,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IACtB,CAAC;IACH,aAAC;AAAD,CAAC,AA7CD,IA6CC"}
|
package/core/src/utils/canvas.js
CHANGED
@@ -1,7 +0,0 @@
|
|
1
|
-
import {Node} from "../models";
|
2
|
-
|
3
|
-
export declare function setTagIdData(data: any): [];
|
4
|
-
export declare function setKpiAddrData(data: any): [];
|
5
|
-
export declare function setAssetIdData(data: any): [];
|
6
|
-
export declare function setAreaIdData(data: any): [];
|
7
|
-
export declare function setThreeCategoryIdData(pen: Node, data: any): [];
|
@@ -1,54 +0,0 @@
|
|
1
|
-
export function setTagIdData(data) {
|
2
|
-
return [{
|
3
|
-
"key": "tagId",
|
4
|
-
"value": data.tagId,
|
5
|
-
"isControlDis": data.isControlDis,
|
6
|
-
"type": data.tagType,
|
7
|
-
"tagVal": data.value,
|
8
|
-
"valExplain": data.valExplain,
|
9
|
-
"tagId": data.tagId
|
10
|
-
}, {
|
11
|
-
"key": "测点名称",
|
12
|
-
"value": data.tagName
|
13
|
-
}];
|
14
|
-
}
|
15
|
-
export function setKpiAddrData(data) {
|
16
|
-
return [{
|
17
|
-
"key": "kpiAddr",
|
18
|
-
"value": data.kpiId + '_' + data.kpiAddr,
|
19
|
-
"isControlDis": data.isControlDis,
|
20
|
-
"type": data.tagType
|
21
|
-
}, {
|
22
|
-
"key": "指标名称",
|
23
|
-
"value": data.kpiName
|
24
|
-
}];
|
25
|
-
}
|
26
|
-
export function setAssetIdData(data) {
|
27
|
-
return [{
|
28
|
-
"key": "assetId",
|
29
|
-
"value": data.id
|
30
|
-
}, {
|
31
|
-
"key": "资产名称",
|
32
|
-
"value": data.name
|
33
|
-
}];
|
34
|
-
}
|
35
|
-
export function setAreaIdData(data) {
|
36
|
-
return [{
|
37
|
-
"key": "areaId",
|
38
|
-
"value": data.id
|
39
|
-
}, {
|
40
|
-
"key": "区域名称",
|
41
|
-
"value": data.name
|
42
|
-
}];
|
43
|
-
}
|
44
|
-
export function setThreeCategoryIdData(pen, data) {
|
45
|
-
let params = [];
|
46
|
-
const hasThreeCategoryId = pen.data.find((tc) => {
|
47
|
-
return tc.key === 'threeCategoryId' && tc.value.includes(data.threeCategoryId);
|
48
|
-
});
|
49
|
-
if(!hasThreeCategoryId) params = [{
|
50
|
-
"key": "threeCategoryId",
|
51
|
-
"value": data.threeCategoryId
|
52
|
-
}];
|
53
|
-
return params;
|
54
|
-
}
|
package/core/src/utils/dom.d.ts
CHANGED
@@ -1,9 +1,8 @@
|
|
1
|
-
import { Node } from '../models';
|
2
|
-
|
1
|
+
import { Node } from '../models/node';
|
2
|
+
// @ts-ignore
|
3
|
+
import { TopologyData } from 'dcim-topology/core'
|
3
4
|
export declare let DomElements: {};
|
4
|
-
export declare
|
5
|
-
export declare function
|
6
|
-
export declare function createIframeElement(node: Node): HTMLDivElement;
|
7
|
-
export declare function setStyleForElementIdDiv(node: Node, elem: HTMLElement, data: visualization2DStore): void;
|
5
|
+
export declare function createChildrenDivByElementId(node: Node, data?: TopologyData): HTMLDivElement;
|
6
|
+
export declare function setStyleForElementIdDiv(node: Node, elem: HTMLElement, data: TopologyData): void;
|
8
7
|
export declare function createDiv(node: Node): HTMLDivElement;
|
9
8
|
export declare function loadJS(url: string, callback?: () => void, render?: boolean): void;
|
package/core/src/utils/dom.js
CHANGED
@@ -1,74 +1,40 @@
|
|
1
|
-
import {Store} from 'le5le-store';
|
2
|
-
import {Lock} from '
|
3
|
-
import {commonStore} from '../store';
|
4
|
-
|
1
|
+
import { Store } from 'le5le-store';
|
2
|
+
import { Lock } from 'dcim-topology/core/src/models/status'
|
5
3
|
export let DomElements = {};
|
6
|
-
export let DomIframes = {};
|
7
|
-
|
8
4
|
export function createChildrenDivByElementId(node, data) {
|
9
|
-
|
10
|
-
|
11
|
-
if (node.
|
12
|
-
|
13
|
-
DomElements[node.id] = document.getElementById(node.id);
|
14
|
-
if (DomElements[node.id]) {
|
15
|
-
document.querySelector('.canvas-point').appendChild(DomElements[node.id]);
|
16
|
-
}
|
17
|
-
}
|
18
|
-
setStyleForElementIdDiv(node, DomElements[node.id], data);
|
19
|
-
}
|
20
|
-
// iframe元件的初始化渲染
|
21
|
-
if (node.iframe) {
|
22
|
-
if (!DomIframes[node.id]) {
|
23
|
-
let iframe = document.getElementById(`iframe${node.id}`);
|
24
|
-
if (!(iframe && iframe.length)) iframe = createIframeElement(node);
|
25
|
-
DomIframes[node.id] = iframe;
|
26
|
-
if (DomIframes[node.id]) {
|
27
|
-
commonStore[node.TID].parentElem.appendChild(DomIframes[node.id]);
|
28
|
-
}
|
29
|
-
}
|
30
|
-
setStyleForElementIdDiv(node, DomIframes[node.id], data);
|
5
|
+
if (!DomElements[node.id]) {
|
6
|
+
DomElements[node.id] = document.getElementById(node.id);
|
7
|
+
if (DomElements[node.id]) {
|
8
|
+
document.querySelector('.canvas-point').appendChild(DomElements[node.id]);
|
31
9
|
}
|
10
|
+
}
|
11
|
+
setStyleForElementIdDiv(node, DomElements[node.id], data);
|
32
12
|
}
|
33
|
-
|
34
|
-
export function createIframeElement(node) {
|
35
|
-
const iframe = document.createElement('iframe');
|
36
|
-
// iframe.scrolling = 'no';
|
37
|
-
iframe.frameBorder = '0';
|
38
|
-
iframe.src = node.iframe;
|
39
|
-
iframe.width = node.rect.width;
|
40
|
-
iframe.height = node.rect.height;
|
41
|
-
iframe.setAttribute('id', `iframe${node.id}`);
|
42
|
-
iframe.setAttribute('class', 'topology2dConfIfram');
|
43
|
-
return iframe;
|
44
|
-
}
|
45
|
-
|
46
13
|
export function setStyleForElementIdDiv(node, elem, data) {
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
14
|
+
if (!elem) {
|
15
|
+
return;
|
16
|
+
}
|
17
|
+
elem.style.position = 'absolute';
|
18
|
+
elem.style.outline = 'none';
|
19
|
+
elem.style.left = node.rect.x + 'px';
|
20
|
+
elem.style.top = node.rect.y + 'px';
|
21
|
+
elem.style.width = node.rect.width + 'px';
|
22
|
+
elem.style.height = node.rect.height + 'px';
|
23
|
+
if (node.rotate || node.offsetRotate) {
|
24
|
+
elem.style.transform = "rotate(" + (node.rotate + node.offsetRotate) + "deg)";
|
25
|
+
}
|
26
|
+
// if (node.video && this.videos[node.id] && this.videos[node.id].media) {
|
27
|
+
// this.videos[node.id].media.style.width = '100%';
|
28
|
+
// this.videos[node.id].media.style.height = '100%';
|
29
|
+
// }
|
30
|
+
if (data && data.locked > Lock.None || node.locked > Lock.None) {
|
31
|
+
elem.style.userSelect = 'initial';
|
32
|
+
elem.style.pointerEvents = 'initial';
|
33
|
+
} else {
|
34
|
+
elem.style.userSelect = 'none';
|
35
|
+
elem.style.pointerEvents = 'none';
|
36
|
+
}
|
70
37
|
}
|
71
|
-
|
72
38
|
export function createDiv(node) {
|
73
39
|
var div = document.createElement('div');
|
74
40
|
div.style.position = 'absolute';
|
@@ -83,21 +49,19 @@ export function createDiv(node) {
|
|
83
49
|
div.id = node.id;
|
84
50
|
return div;
|
85
51
|
}
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
//
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
// }
|
102
|
-
|
52
|
+
export function loadJS(url, callback, render) {
|
53
|
+
var loaderScript = document.createElement('script');
|
54
|
+
loaderScript.type = 'text/javascript';
|
55
|
+
loaderScript.src = url;
|
56
|
+
loaderScript.addEventListener('load', function () {
|
57
|
+
if (callback) {
|
58
|
+
callback();
|
59
|
+
}
|
60
|
+
// how to do
|
61
|
+
if (render) {
|
62
|
+
Store.set('LT:render', true);
|
63
|
+
}
|
64
|
+
});
|
65
|
+
document.body.appendChild(loaderScript);
|
66
|
+
}
|
103
67
|
//# sourceMappingURL=dom.js.map
|
package/core/src/utils/index.js
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
import { ptInPolyXY } from './math';
|
2
2
|
import { moveDataType, downDataType } from './construction'
|
3
|
-
import { Node } from '../models'
|
4
3
|
// 执行window函数
|
5
4
|
export function omouseEventPrototDoWindowFn (eventNode, node) {
|
6
5
|
|
@@ -19,16 +18,8 @@ export function mousMoveFun(type, pos, data) {
|
|
19
18
|
|
20
19
|
for (var _i = 0, _a = data; _i < _a.length; _i++) {
|
21
20
|
var item = _a[_i];
|
22
|
-
|
23
|
-
|
24
|
-
if(item.name === 'arbitraryGraph') {
|
25
|
-
// 任意多边形通过点获取区域
|
26
|
-
isInPointNode = ptInPolyXY(pos, item.rotatedAnchors);
|
27
|
-
}else {
|
28
|
-
if(!(item instanceof Node)) item = new Node(item);
|
29
|
-
isInPointNode = item.hit(pos);
|
30
|
-
}
|
31
|
-
if(isInPointNode) {
|
21
|
+
const isPoint = ptInPolyXY(pos, item.rotatedAnchors);
|
22
|
+
if(isPoint) {
|
32
23
|
params.hoverNode = item;
|
33
24
|
params.order = _i;
|
34
25
|
}
|
@@ -52,7 +43,7 @@ export function mousDownFun(type, eventNode) {
|
|
52
43
|
if(action === 3) {
|
53
44
|
params.eventType = downDataType.Window; // 打开会话窗口
|
54
45
|
}else if(action === 7){
|
55
|
-
params.eventType = downDataType.Showhide; //
|
46
|
+
params.eventType = downDataType.Showhide; // 链接跳转
|
56
47
|
params.value = eventNode.value;
|
57
48
|
}else if(action === 8){
|
58
49
|
params.eventType = downDataType.Tabswitch; // Tab切换
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import { Node } from '
|
1
|
+
import { Node } from 'dcim-topology/core';
|
2
2
|
export declare function flowCommentAnchors(node: Node): void;
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import { Node } from '
|
1
|
+
import { Node } from 'dcim-topology/core';
|
2
2
|
export declare function flowComment(ctx: CanvasRenderingContext2D, node: Node): void;
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import { Node } from '
|
1
|
+
import { Node } from 'dcim-topology/core';
|
2
2
|
export declare function flowDataAnchors(node: Node): void;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Point, Direction } from '
|
1
|
+
import { Point, Direction } from 'dcim-topology/core';
|
2
2
|
export function flowDataAnchors(node) {
|
3
3
|
node.anchors.push(new Point(node.rect.x + node.rect.width / 14, node.rect.y + node.rect.height / 2, Direction.Left));
|
4
4
|
node.anchors.push(new Point(node.rect.x + (node.rect.width * 4) / 7, node.rect.y, Direction.Up));
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import { Node } from '
|
1
|
+
import { Node } from 'dcim-topology/core';
|
2
2
|
export declare function flowData(ctx: CanvasRenderingContext2D, node: Node): void;
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import { Node } from '
|
1
|
+
import { Node } from 'dcim-topology/core';
|
2
2
|
export declare function flowDb(ctx: CanvasRenderingContext2D, node: Node): void;
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import { Node } from '
|
1
|
+
import { Node } from 'dcim-topology/core';
|
2
2
|
export declare function flowDisplayAnchors(node: Node): void;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Point, Direction } from '
|
1
|
+
import { Point, Direction } from 'dcim-topology/core';
|
2
2
|
export function flowDisplayAnchors(node) {
|
3
3
|
node.anchors.push(new Point(node.rect.x, node.rect.y + node.rect.height / 2, Direction.Left));
|
4
4
|
node.anchors.push(new Point(node.rect.x + node.rect.width / 2, node.rect.y, Direction.Up));
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import { Node } from '
|
1
|
+
import { Node } from 'dcim-topology/core';
|
2
2
|
export declare function flowDisplay(ctx: CanvasRenderingContext2D, node: Node): void;
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import { Node } from '
|
1
|
+
import { Node } from 'dcim-topology/core';
|
2
2
|
export declare function flowDocumentAnchors(node: Node): void;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Point, Direction } from '
|
1
|
+
import { Point, Direction } from 'dcim-topology/core';
|
2
2
|
export function flowDocumentAnchors(node) {
|
3
3
|
node.anchors.push(new Point(node.rect.x, node.rect.y + node.rect.height / 2, Direction.Left));
|
4
4
|
node.anchors.push(new Point(node.rect.x + node.rect.width / 2, node.rect.y, Direction.Up));
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import { Node } from '
|
1
|
+
import { Node } from 'dcim-topology/core';
|
2
2
|
export declare function flowDocument(ctx: CanvasRenderingContext2D, node: Node): void;
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import { Node } from '
|
1
|
+
import { Node } from 'dcim-topology/core';
|
2
2
|
export declare function flowExternStorageAnchors(node: Node): void;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Point, Direction } from '
|
1
|
+
import { Point, Direction } from 'dcim-topology/core';
|
2
2
|
export function flowExternStorageAnchors(node) {
|
3
3
|
node.anchors.push(new Point(node.rect.x, node.rect.y + node.rect.height / 2, Direction.Left));
|
4
4
|
node.anchors.push(new Point(node.rect.x + (node.rect.width * 8) / 15, node.rect.y, Direction.Up));
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import { Node } from '
|
1
|
+
import { Node } from 'dcim-topology/core';
|
2
2
|
export declare function flowExternStorage(ctx: CanvasRenderingContext2D, node: Node): void;
|