dcim-topology2d 1.0.3 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. package/chart-diagram/src/echarts/index.js +3 -6
  2. package/core/index.d.ts +1 -0
  3. package/core/index.js +1 -0
  4. package/core/src/activeLayer.d.ts +2 -10
  5. package/core/src/activeLayer.js +42 -41
  6. package/core/src/animateLayer.d.ts +3 -7
  7. package/core/src/animateLayer.js +10 -12
  8. package/core/src/calling.d.ts +1 -4
  9. package/core/src/calling.js +38 -41
  10. package/core/src/canvas.d.ts +1 -6
  11. package/core/src/canvas.js +17 -18
  12. package/core/src/common.d.ts +5 -5
  13. package/core/src/common.js +147 -110
  14. package/core/src/core.d.ts +3 -4
  15. package/core/src/core.js +222 -251
  16. package/core/src/divLayer.d.ts +2 -7
  17. package/core/src/divLayer.js +25 -25
  18. package/core/src/healps/changeData.d.ts +1 -1
  19. package/core/src/healps/changeData.js +31 -11
  20. package/core/src/hoverLayer.d.ts +2 -9
  21. package/core/src/hoverLayer.js +31 -34
  22. package/core/src/models/index.d.ts +0 -1
  23. package/core/src/models/index.js +0 -1
  24. package/core/src/offscreen.d.ts +1 -4
  25. package/core/src/offscreen.js +10 -8
  26. package/core/src/options.js +1 -0
  27. package/core/src/preview.d.ts +1 -13
  28. package/core/src/preview.js +26 -27
  29. package/core/src/renderLayer.d.ts +1 -3
  30. package/core/src/renderLayer.js +26 -31
  31. package/core/src/store/common.d.ts +9 -0
  32. package/core/src/store/common.js +5 -0
  33. package/core/src/store/data.d.ts +126 -0
  34. package/core/src/store/data.js +80 -0
  35. package/core/src/store/index.d.ts +2 -0
  36. package/core/src/store/index.js +2 -0
  37. package/core/src/utils/conversion.d.ts +7 -0
  38. package/core/src/utils/conversion.js +54 -0
  39. package/core/src/utils/dom.d.ts +4 -3
  40. package/core/src/utils/dom.js +2 -0
  41. package/package.json +1 -1
  42. package/core/src/models/data.d.ts +0 -26
  43. package/core/src/models/data.js +0 -77
  44. package/core/src/models/data.js.map +0 -1
  45. package/core/src/mqtt.d.ts +0 -14
  46. package/core/src/mqtt.js +0 -82
  47. package/core/src/mqtt.js.map +0 -1
  48. package/core/src/socket.d.ts +0 -10
  49. package/core/src/socket.js +0 -51
  50. package/core/src/socket.js.map +0 -1
@@ -1,77 +0,0 @@
1
- import { Node } from './node';
2
- import { Line } from './line';
3
- import { Lock } from './status';
4
- import { s8 } from '../utils';
5
- var TopologyData = /** @class */ (function () {
6
- function TopologyData(json) {
7
- this.pens = [];
8
- this.lineName = 'curve';
9
- this.fromArrowType = '';
10
- this.toArrowType = 'triangleSolid';
11
- this.scale = 1;
12
- this.locked = Lock.None;
13
- this.bkImageRect = null;
14
- this.mqttOptions = {
15
- clientId: s8()
16
- };
17
- this.dataConstruct = {};
18
- if (json) {
19
- this.pens = [];
20
- json.dataConstruct = {};
21
- for (var _i = 0, _a = json.pens; _i < _a.length; _i++) {
22
- var item = _a[_i];
23
- if (item.from) {
24
- this.pens.push(new Line(item));
25
- }
26
- else {
27
- if(item.name === 'formTable') {
28
- json.dataConstruct[item.id] = {
29
- id: item.id,
30
- name: 'table'
31
- }
32
- }
33
- this.pens.push(new Node(item));
34
- }
35
- }
36
- this.lineName = json.lineName || 'curve';
37
- this.fromArrowType = json.fromArrowType || '';
38
- this.toArrowType = json.toArrowType || 'triangleSolid';
39
- this.scale = json.scale || 1;
40
- this.locked = json.locked || Lock.None;
41
- this.bkImage = json.bkImage;
42
- this.bkColor = json.bkColor;
43
- this.grid = json.grid;
44
- this.manualCps = json.manualCps;
45
- this.websocket = json.websocket;
46
- this.mqttUrl = json.mqttUrl;
47
- this.bkImageRect = json.bkImageRect;
48
- if (json.mqttOptions) {
49
- var opts = '';
50
- if (typeof json.mqttOptions === 'object') {
51
- opts = JSON.stringify(json.mqttOptions);
52
- }
53
- else {
54
- opts = json.mqttOptions + '';
55
- }
56
- this.mqttOptions = JSON.parse(opts);
57
- }
58
- else {
59
- this.mqttOptions = { clientId: s8() };
60
- }
61
- this.dataConstruct = json.dataConstruct ? json.dataConstruct : {};
62
- this.mqttTopics = json.mqttTopics;
63
- if (typeof json.data === 'object') {
64
- this.data = JSON.parse(JSON.stringify(json.data));
65
- }
66
- else {
67
- this.data = json.data || '';
68
- }
69
- }
70
- if (!this.mqttOptions) {
71
- this.mqttOptions = { clientId: s8() };
72
- }
73
- }
74
- return TopologyData;
75
- }());
76
- export { TopologyData };
77
- //# sourceMappingURL=data.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"data.js","sourceRoot":"","sources":["../../../../packages/core/src/models/data.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAE9B;IAsBE,sBAAY,IAAU;QArBtB,SAAI,GAAU,EAAE,CAAC;QACjB,aAAQ,GAAG,OAAO,CAAC;QACnB,kBAAa,GAAG,EAAE,CAAC;QACnB,gBAAW,GAAG,eAAe,CAAC;QAC9B,UAAK,GAAG,CAAC,CAAC;QACV,WAAM,GAAG,IAAI,CAAC,IAAI,CAAC;QAMnB,gBAAW,GAIP;YACA,QAAQ,EAAE,EAAE,EAAE;SACf,CAAC;QAKF,IAAI,IAAI,EAAE;YACR,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;YACf,KAAmB,UAAS,EAAT,KAAA,IAAI,CAAC,IAAI,EAAT,cAAS,EAAT,IAAS,EAAE;gBAAzB,IAAM,IAAI,SAAA;gBACb,IAAI,IAAI,CAAC,IAAI,EAAE;oBACb,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;iBAChC;qBAAM;oBACL,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;iBAChC;aACF;YACD,IAA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,CAAC,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;aACnD;iBAAM;gBACL,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;aAC7B;SACF;QACD,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;YACrB,IAAI,CAAC,WAAW,GAAG,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,CAAC;SACvC;IACH,CAAC;IACH,mBAAC;AAAD,CAAC,AAnED,IAmEC"}
@@ -1,14 +0,0 @@
1
- import { TopologyData } from './models';
2
- export declare class MQTT {
3
- url: string;
4
- options: any;
5
- topics: string;
6
- data: TopologyData;
7
- client: any;
8
- constructor(url: string, options: any, topics: string, data: TopologyData);
9
- init(): void;
10
- onmessage: (topic: string, message: any) => void;
11
- publish(topic: string, message: string): void;
12
- close(): void;
13
- isEnd: boolean;
14
- }
package/core/src/mqtt.js DELETED
@@ -1,82 +0,0 @@
1
- import * as mqtt from './mqtt.min.js';
2
- import { EventType } from './models';
3
- import { Store } from 'le5le-store';
4
- var MQTT = /** @class */ (function () {
5
- function MQTT(url, options, topics, data) {
6
- var _this = this;
7
- this.url = url;
8
- this.options = options;
9
- this.topics = topics;
10
- this.data = data;
11
- this.isEnd = false;
12
- this.num = 0; // 记录推送的次数,用于判单丢失情况
13
- this.onmessage = function (topic, message) {
14
- if (!_this.data.pens.length || !topic || topic != _this.data.mqttTopics) {
15
- return;
16
- }
17
- console.log((new Date()).toString().substring(16,24))
18
- // 判单推送是否有失丢
19
- var theNum = JSON.parse(message.toString()).pushNumber
20
- if((theNum - this.num) > 1) {
21
- console.log('发生丢失!')
22
- console.log('上次的计数===',this.num)
23
- console.log('当前的计数===',theNum)
24
- // 再次主动请求
25
- Store.set('mqttLostMessage', true);
26
- }else{
27
- Store.set('mqttLostMessage', false);
28
- }
29
- this.num = JSON.parse(message.toString()).pushNumber
30
- console.log('已执行的计数===',this.num)
31
- console.log('\n')
32
-
33
- if(!_this.isEnd){
34
- _this.getPen(_this.data.pens, topics, message)
35
- }
36
- };
37
- //服务器连接异常的回调
38
- this.onerror= function (error) {
39
- console.log('服务器连接异常',error)
40
-
41
- };
42
- this.init();
43
- }
44
- MQTT.prototype.init = function () {
45
- this.client = mqtt.connect(this.url, this.options);
46
- console.log('connect===',this.options)
47
- this.client.on('message', this.onmessage);
48
- if (this.topics) {
49
- this.client.subscribe(this.topics.split(','));
50
- }
51
- };
52
- MQTT.prototype.publish = function (topic, message) {
53
- this.client.publish(topic, message);
54
- };
55
- MQTT.prototype.close = function () {
56
- this.isEnd = true
57
- this.client.end();
58
- };
59
- MQTT.prototype.getPen = function (pens, topics, message) {
60
- const _this = this;
61
- pens.forEach((pen)=>{
62
- if(pen.children != undefined){
63
- _this.getPen(pen.children, topics, message)
64
- }else{
65
- var item = pen;
66
- for (var _b = 0, _c = item.events; _b < _c.length; _b++) {
67
- var event_1 = _c[_b];
68
- if (event_1.type === EventType.Mqtt) {
69
- event_1.name = topics;
70
- if(message){
71
- item.doSocketMqtt(event_1, message.toString(), _this.client);
72
- }
73
- }
74
- }
75
- }
76
- })
77
- };
78
- return MQTT;
79
- }());
80
-
81
- export { MQTT };
82
- //# sourceMappingURL=mqtt.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mqtt.js","sourceRoot":"","sources":["../../../packages/core/src/mqtt.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,IAAI,MAAM,eAAe,CAAC;AAEtC,OAAO,EAAE,SAAS,EAAgB,MAAM,UAAU,CAAC;AAEnD;IAEE,cAAmB,GAAW,EAAS,OAAY,EAAS,MAAc,EAAS,IAAkB;QAArG,iBAEC;QAFkB,QAAG,GAAH,GAAG,CAAQ;QAAS,YAAO,GAAP,OAAO,CAAK;QAAS,WAAM,GAAN,MAAM,CAAQ;QAAS,SAAI,GAAJ,IAAI,CAAc;QAarG,cAAS,GAAG,UAAC,KAAa,EAAE,O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CAAC,GAAG,EAAE,CAAC;IACpB,CAAC;IACH,WAAC;AAAD,CAAC,AAtCD,IAsCC"}
@@ -1,10 +0,0 @@
1
- import { TopologyData } from './models';
2
- export declare class Socket {
3
- url: string;
4
- data: TopologyData;
5
- socket: WebSocket;
6
- constructor(url: string, data: TopologyData);
7
- init(): void;
8
- onmessage: (e: MessageEvent) => void;
9
- close(): void;
10
- }
@@ -1,51 +0,0 @@
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
@@ -1 +0,0 @@
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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