dcim-topology2d 1.1.3 → 3.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (139) hide show
  1. package/activity-diagram/src/final/final.d.ts +1 -1
  2. package/activity-diagram/src/final/final.rect.d.ts +1 -1
  3. package/activity-diagram/src/final/final.rect.js +1 -1
  4. package/activity-diagram/src/fork/fork.anchor.d.ts +1 -1
  5. package/activity-diagram/src/fork/fork.anchor.js +1 -1
  6. package/activity-diagram/src/fork/fork.d.ts +1 -1
  7. package/activity-diagram/src/fork/fork.rect.d.ts +1 -1
  8. package/activity-diagram/src/fork/fork.rect.js +1 -1
  9. package/activity-diagram/src/register.js +1 -1
  10. package/activity-diagram/src/swimlaneH/swimlaneH.d.ts +1 -1
  11. package/activity-diagram/src/swimlaneH/swimlaneH.rect.d.ts +1 -1
  12. package/activity-diagram/src/swimlaneH/swimlaneH.rect.js +1 -1
  13. package/activity-diagram/src/swimlaneV/swimlaneV.d.ts +1 -1
  14. package/activity-diagram/src/swimlaneV/swimlaneV.rect.d.ts +1 -1
  15. package/activity-diagram/src/swimlaneV/swimlaneV.rect.js +1 -1
  16. package/chart-diagram/src/echarts/index.d.ts +1 -1
  17. package/chart-diagram/src/echarts/index.js +7 -10
  18. package/chart-diagram/src/register.js +1 -1
  19. package/class-diagram/src/class/class.d.ts +1 -1
  20. package/class-diagram/src/class/class.rect.d.ts +1 -1
  21. package/class-diagram/src/class/class.rect.js +1 -1
  22. package/class-diagram/src/register.js +1 -1
  23. package/core/index.d.ts +0 -1
  24. package/core/index.js +0 -1
  25. package/core/src/activeLayer.d.ts +10 -2
  26. package/core/src/activeLayer.js +41 -42
  27. package/core/src/animateLayer.d.ts +7 -3
  28. package/core/src/animateLayer.js +12 -10
  29. package/core/src/calling.d.ts +4 -1
  30. package/core/src/calling.js +41 -40
  31. package/core/src/canvas.d.ts +6 -1
  32. package/core/src/canvas.js +18 -17
  33. package/core/src/common.d.ts +5 -5
  34. package/core/src/common.js +115 -161
  35. package/core/src/core.d.ts +4 -3
  36. package/core/src/core.js +253 -228
  37. package/core/src/divLayer.d.ts +7 -2
  38. package/core/src/divLayer.js +25 -25
  39. package/core/src/healps/changeData.d.ts +1 -1
  40. package/core/src/healps/changeData.js +42 -77
  41. package/core/src/hoverLayer.d.ts +9 -2
  42. package/core/src/hoverLayer.js +34 -31
  43. package/core/src/models/data.d.ts +26 -0
  44. package/core/src/models/data.js +77 -0
  45. package/core/src/models/data.js.map +1 -0
  46. package/core/src/models/index.d.ts +1 -0
  47. package/core/src/models/index.js +1 -0
  48. package/core/src/models/node.js +12 -14
  49. package/core/src/models/pen.js +1 -10
  50. package/core/src/mqtt.d.ts +14 -0
  51. package/core/src/mqtt.js +82 -0
  52. package/core/src/mqtt.js.map +1 -0
  53. package/core/src/offscreen.d.ts +4 -1
  54. package/core/src/offscreen.js +8 -10
  55. package/core/src/options.js +0 -1
  56. package/core/src/poll.js +2 -0
  57. package/core/src/preview.d.ts +13 -1
  58. package/core/src/preview.js +34 -42
  59. package/core/src/renderLayer.d.ts +3 -1
  60. package/core/src/renderLayer.js +31 -26
  61. package/core/src/socket.d.ts +10 -0
  62. package/core/src/socket.js +51 -0
  63. package/core/src/socket.js.map +1 -0
  64. package/core/src/utils/canvas.js +1 -1
  65. package/core/src/utils/conversion.d.ts +0 -7
  66. package/core/src/utils/conversion.js +0 -54
  67. package/core/src/utils/dom.d.ts +5 -4
  68. package/core/src/utils/dom.js +1 -3
  69. package/core/src/utils/onmousevent.js +3 -12
  70. package/flow-diagram/src/comment/comment.anchor.d.ts +1 -1
  71. package/flow-diagram/src/comment/comment.anchor.js +1 -1
  72. package/flow-diagram/src/comment/comment.d.ts +1 -1
  73. package/flow-diagram/src/data/data.anchor.d.ts +1 -1
  74. package/flow-diagram/src/data/data.anchor.js +1 -1
  75. package/flow-diagram/src/data/data.d.ts +1 -1
  76. package/flow-diagram/src/data/data.rect.d.ts +1 -1
  77. package/flow-diagram/src/data/data.rect.js +1 -1
  78. package/flow-diagram/src/db/db.d.ts +1 -1
  79. package/flow-diagram/src/db/db.rect.d.ts +1 -1
  80. package/flow-diagram/src/db/db.rect.js +1 -1
  81. package/flow-diagram/src/display/display.anchor.d.ts +1 -1
  82. package/flow-diagram/src/display/display.anchor.js +1 -1
  83. package/flow-diagram/src/display/display.d.ts +1 -1
  84. package/flow-diagram/src/display/display.rect.d.ts +1 -1
  85. package/flow-diagram/src/display/display.rect.js +1 -1
  86. package/flow-diagram/src/document/document.anchor.d.ts +1 -1
  87. package/flow-diagram/src/document/document.anchor.js +1 -1
  88. package/flow-diagram/src/document/document.d.ts +1 -1
  89. package/flow-diagram/src/document/document.rect.d.ts +1 -1
  90. package/flow-diagram/src/document/document.rect.js +1 -1
  91. package/flow-diagram/src/externStorage/externStorage.anchor.d.ts +1 -1
  92. package/flow-diagram/src/externStorage/externStorage.anchor.js +1 -1
  93. package/flow-diagram/src/externStorage/externStorage.d.ts +1 -1
  94. package/flow-diagram/src/externStorage/externStorage.rect.d.ts +1 -1
  95. package/flow-diagram/src/externStorage/externStorage.rect.js +1 -1
  96. package/flow-diagram/src/internalStorage/internalStorage.d.ts +1 -1
  97. package/flow-diagram/src/internalStorage/internalStorage.rect.d.ts +1 -1
  98. package/flow-diagram/src/internalStorage/internalStorage.rect.js +1 -1
  99. package/flow-diagram/src/manually/manually.anchor.d.ts +1 -1
  100. package/flow-diagram/src/manually/manually.anchor.js +1 -1
  101. package/flow-diagram/src/manually/manually.d.ts +1 -1
  102. package/flow-diagram/src/manually/manually.rect.d.ts +1 -1
  103. package/flow-diagram/src/manually/manually.rect.js +1 -1
  104. package/flow-diagram/src/parallel/parallel.anchor.d.ts +1 -1
  105. package/flow-diagram/src/parallel/parallel.anchor.js +1 -1
  106. package/flow-diagram/src/parallel/parallel.d.ts +1 -1
  107. package/flow-diagram/src/queue/queue.d.ts +1 -1
  108. package/flow-diagram/src/queue/queue.rect.d.ts +1 -1
  109. package/flow-diagram/src/queue/queue.rect.js +1 -1
  110. package/flow-diagram/src/register.js +1 -1
  111. package/flow-diagram/src/subprocess/subprocess.d.ts +1 -1
  112. package/flow-diagram/src/subprocess/subprocess.rect.d.ts +1 -1
  113. package/flow-diagram/src/subprocess/subprocess.rect.js +1 -1
  114. package/layout/src/align.d.ts +1 -1
  115. package/layout/src/align.js +1 -1
  116. package/layout/src/layout.d.ts +1 -1
  117. package/layout/src/layout.js +1 -1
  118. package/myShape-diagram/myShape.js +1 -1
  119. package/package.json +1 -1
  120. package/sequence-diagram/src/focus/focus.anchor.d.ts +1 -1
  121. package/sequence-diagram/src/focus/focus.anchor.js +1 -1
  122. package/sequence-diagram/src/focus/focus.d.ts +1 -1
  123. package/sequence-diagram/src/focus/focus.rect.d.ts +1 -1
  124. package/sequence-diagram/src/focus/focus.rect.js +1 -1
  125. package/sequence-diagram/src/lifeline/lifeline.anchor.d.ts +1 -1
  126. package/sequence-diagram/src/lifeline/lifeline.anchor.js +1 -1
  127. package/sequence-diagram/src/lifeline/lifeline.d.ts +1 -1
  128. package/sequence-diagram/src/lifeline/lifeline.rect.d.ts +1 -1
  129. package/sequence-diagram/src/lifeline/lifeline.rect.js +1 -1
  130. package/sequence-diagram/src/register.js +1 -1
  131. package/core/src/store/common.d.ts +0 -9
  132. package/core/src/store/common.js +0 -5
  133. package/core/src/store/data.d.ts +0 -126
  134. package/core/src/store/data.js +0 -80
  135. package/core/src/store/index.d.ts +0 -2
  136. package/core/src/store/index.js +0 -2
  137. package/static/echartsDefaultData.js +0 -95
  138. package/static/index.js +0 -1
  139. package/style/index.css +0 -10
@@ -3,14 +3,14 @@ import {DivLayer} from './divLayer';
3
3
  import {AnimateLayer} from './animateLayer';
4
4
  import {RenderLayer} from './renderLayer';
5
5
  import {Offscreen} from './offscreen';
6
- import {Line, Node, Point, EventAction} from './models';
7
- import {setConfItemNode, setStatisticalData} from './healps';
8
- import {s8, formatPadding, getRect} from './utils';
9
- import { useStore, clearStore } from './store'
6
+ import {Socket} from './socket';
7
+ import {Line, Node, Pen, Point, TopologyData, EventAction} from './models';
8
+ import {setConfItemNode} from './healps';
9
+ import {s8, formatPadding, getRect, previewType} from './utils';
10
+ import {DefalutOptions} from './options';
10
11
  import {POLL} from './poll';
11
12
  import axios from 'axios';
12
13
  import * as mqtt from './mqtt.min';
13
- import {echartsDefaultDataMap, echartsLineBarDefaultLegendData} from "../../static";
14
14
 
15
15
  var MoveInType;
16
16
  (function (MoveInType) {
@@ -29,33 +29,28 @@ var Common = /** @class */ (function () {
29
29
  function Common(parent, options) {
30
30
  var _this = this;
31
31
  _this.moveInType = MoveInType;
32
- this.mqttDataSouse = axios.CancelToken.source();
33
32
  this.mouseDown = null;
34
- this.renderTimer = 0;
35
- this.lastRender = 0;
36
- this.id = s8();
37
- this.store = useStore(this.id);
38
33
  if (typeof parent === 'string') {
39
- this.store.parentElem = document.getElementById(parent);
34
+ this.parentElem = document.getElementById(parent);
40
35
  } else {
41
- this.store.parentElem = parent;
36
+ this.parentElem = parent;
42
37
  }
43
38
  if (!options) {
44
39
  options = {};
45
40
  }
46
- this.store.parentElem.style.position = 'relative';
47
- this.store.parentElem.style.overflow = 'auto';
48
- //var font = Object.assign({}, DefalutOptions.font, options.font);
49
- //options.font = font;
50
- // this.options = Object.assign({}, DefalutOptions, options);
51
- Object.assign(this.store.options, options);
52
- this.store.options.interval = 50;
53
- //Store.set(this.generateStoreKey('topology-data'), this.data);
41
+ this.parentElem.style.position = 'relative';
42
+ this.parentElem.style.overflow = 'auto';
43
+ var font = Object.assign({}, DefalutOptions.font, options.font);
44
+ options.font = font;
45
+ this.options = Object.assign({}, DefalutOptions, options);
46
+ this.data = new TopologyData();
47
+ this.id = s8();
48
+ Store.set(this.generateStoreKey('topology-data'), this.data);
54
49
  var id = this.id;
55
- this.animateLayer = new AnimateLayer(id);
56
- this.offscreen = new Offscreen(id);
57
- this.canvas = new RenderLayer(id);
58
- this.divLayer = new DivLayer(id);
50
+ this.animateLayer = new AnimateLayer(this.options, id);
51
+ this.offscreen = new Offscreen(this.parentElem, this.options, id);
52
+ this.canvas = new RenderLayer(this.parentElem, this.options, id);
53
+ this.divLayer = new DivLayer(this.parentElem, this.options, id);
59
54
  this.divLayer.canvas.tabIndex = 0;
60
55
  this.divLayer.canvas.ondblclick = this.ondblclick;
61
56
  this.divLayer.canvas.onblur = function () {
@@ -114,6 +109,7 @@ var Common = /** @class */ (function () {
114
109
  };
115
110
  this.openCount = 0;
116
111
  this.timmerByTopology = null;
112
+ this.ratioCord = null;
117
113
  this.lastTranlated = {x: 0, y: 0};
118
114
  this.moveIn = {
119
115
  type: 'None',
@@ -140,6 +136,7 @@ var Common = /** @class */ (function () {
140
136
  this.tip = '';
141
137
  this.rendering = false;
142
138
  this.isFullScreen = false;
139
+ this.socket = null;
143
140
  this.inputObj = null;
144
141
  this.input = document.createElement('textarea');
145
142
  this.input.style.position = 'absolute';
@@ -150,11 +147,11 @@ var Common = /** @class */ (function () {
150
147
  this.input.style.outline = 'none';
151
148
  this.input.style.border = '1px solid #cdcdcd';
152
149
  this.input.style.resize = 'none';
153
- this.store.parentElem.appendChild(this.input);
150
+ this.parentElem.appendChild(this.input);
154
151
  this.paginationPageListBox = document.createElement('ul');
155
152
  this.pagenationPageInput = document.createElement('input');
156
153
  this.tablePaginationPageStyle();
157
- this.store.parentElem.appendChild(this.paginationPageListBox);
154
+ this.parentElem.appendChild(this.paginationPageListBox);
158
155
  // 列表数据选取
159
156
  this.paginationPageListNode = function (ev) {
160
157
  const node = _this.moveIn.activeNode;
@@ -177,71 +174,59 @@ var Common = /** @class */ (function () {
177
174
  window.topology = this;
178
175
  }
179
176
 
180
- Common.prototype.conversionData = function (obj, type) {
181
- this.clear();
177
+ Common.prototype.conversionData = function (obj) {
178
+ this.parentElem.scrollLeft = 0;
179
+ this.parentElem.scrollTop = 0;
180
+ this.canvas.clearBkImg();
181
+ this.divLayer.clear();
182
182
  let data = JSON.parse(JSON.stringify(obj));
183
183
  if (!data) {
184
184
  data = {pens: []};
185
185
  }
186
- Object.assign(this.store.data, data);
187
- this.store.data.pens = [];
186
+ Object.assign(this.data, data);
188
187
  this.setBKImageRect();
188
+ this.ratioCord = {
189
+ ratio: 1,
190
+ scaleX: 1,
191
+ scaleY: 1
192
+ };
189
193
  this.openCount = 0
194
+ this.data.pens = [];
190
195
  // for old data.
191
196
  if (data.nodes) {
192
197
  for (var _i = 0, _a = data.nodes; _i < _a.length; _i++) {
193
- const item = new Node(_a[_i]);
194
- this.store.data.pens.push(item);
195
- this.store.pens[item.id] = item;
198
+ var item = new Node(_a[_i]);
199
+ this.data.pens.push(item);
196
200
  this.setSwitchTabData(item, _i);
197
- // 初始化图表数据
198
- if (item.name === 'echarts' && item.data && type !== 'mqtt') {
199
- item.data.echarts.option = setStatisticalData(item, 'def');
200
- }
201
201
  }
202
202
  for (var _b = 0, _c = data.lines; _b < _c.length; _b++) {
203
- const item = new Line(_c[_b]);
204
- this.store.data.pens.push(item);
205
- this.store.pens[item.id] = item;
203
+ var item = _c[_b];
204
+ this.data.pens.push(new Line(item));
206
205
  }
207
206
  }
208
207
  // end.
209
208
  if (data.pens) {
210
209
  for (var _d = 0, _e = data.pens; _d < _e.length; _d++) {
211
- const item = _e[_d];
210
+ var item = _e[_d];
212
211
  if (!item.from) {
213
- const node = new Node(item);
214
- this.store.data.pens.push(node);
215
- this.store.pens[item.id] = node;
212
+ var node = new Node(item);
213
+ this.data.pens.push(node);
216
214
  this.setSwitchTabData(node, _d);
217
- // 初始化图表数据
218
- if (node.name === 'echarts' && node.data && type !== 'mqtt') {
219
- node.data.echarts.option = setStatisticalData(node, 'def');
220
- }
221
215
  } else {
222
- const linNode = new Line(item);
223
- this.store.data.pens.push(linNode);
224
- this.store.pens[item.id] = linNode;
216
+ this.data.pens.push(new Line(item));
225
217
  }
226
218
  }
227
219
  }
228
220
  };
229
- Common.prototype.clear = function (del){
230
- clearStore(this.store, del);
231
- this.canvas.clearBkImg();
232
- this.divLayer.clear();
233
- this.store.parentElem.scrollLeft = 0;
234
- this.store.parentElem.scrollTop = 0;
235
- };
236
221
  Common.prototype.setBKImageRect = function () {
237
- if (this.store.data.bkImageRect) {
238
- this.store.data.bkImageRect.x = this.store.data.bkImageRect.x ? Number(this.store.data.bkImageRect.x) : 0;
239
- this.store.data.bkImageRect.y = this.store.data.bkImageRect.y ? Number(this.store.data.bkImageRect.y) : 0;
240
- this.store.data.bkImageRect.width = this.store.data.bkImageRect.width ? Number(this.store.data.bkImageRect.width) : this.canvas.width;
241
- this.store.data.bkImageRect.height = this.store.data.bkImageRect.height ? Number(this.store.data.bkImageRect.height) : this.canvas.height;
242
- this.store.data.bkImageRect.center = {
243
- x: this.store.data.bkImageRect.x + this.store.data.bkImageRect.width / 2,
244
- y: this.store.data.bkImageRect.y + this.store.data.bkImageRect.height / 2
222
+ if (this.data.bkImageRect) {
223
+ this.data.bkImageRect.x = this.data.bkImageRect.x ? Number(this.data.bkImageRect.x) : 0;
224
+ this.data.bkImageRect.y = this.data.bkImageRect.y ? Number(this.data.bkImageRect.y) : 0;
225
+ this.data.bkImageRect.width = this.data.bkImageRect.width ? Number(this.data.bkImageRect.width) : this.canvas.width;
226
+ this.data.bkImageRect.height = this.data.bkImageRect.height ? Number(this.data.bkImageRect.height) : this.canvas.height;
227
+ this.data.bkImageRect.center = {
228
+ x: this.data.bkImageRect.x + this.data.bkImageRect.width / 2,
229
+ y: this.data.bkImageRect.y + this.data.bkImageRect.height / 2
245
230
  }
246
231
  }
247
232
  };
@@ -277,40 +262,20 @@ var Common = /** @class */ (function () {
277
262
  }
278
263
  };
279
264
  Common.prototype.canvasResize = function (size) {
280
- try {
281
- this.canvas.resize(size);
282
- //this.canvas.bkImgRectResize(size);
283
- this.offscreen.resize(size);
284
- this.divLayer.resize(size);
285
- }catch (err) {
286
- //console.log('resize-----', err)
287
- }
265
+ this.canvas.resize(size);
266
+ //this.canvas.bkImgRectResize(size);
267
+ this.offscreen.resize(size);
268
+ this.divLayer.resize(size);
288
269
  };
289
270
  // Render or redraw
290
271
  Common.prototype.render = function (noFocus) {
291
- try {
292
- const _this = this;
293
- const now = performance.now();
294
- if (now - _this.lastRender < _this.store.options.interval && !noFocus) {
295
- if (_this.renderTimer) {
296
- cancelAnimationFrame(_this.renderTimer);
297
- }
298
- _this.renderTimer = requestAnimationFrame(_this.render);
299
-
300
- return;
301
- }
302
- this.renderTimer = 0;
303
- this.lastRender = now;
304
- if (this.rendering) {
305
- return this;
306
- }
307
- this.rendering = true;
308
- this.offscreen.render();
309
- this.canvas.render();
310
- this.rendering = false;
311
- }catch (e) {
312
- //console.log(e)
272
+ if (this.rendering) {
273
+ return this;
313
274
  }
275
+ this.rendering = true;
276
+ this.offscreen.render();
277
+ this.canvas.render();
278
+ this.rendering = false;
314
279
  };
315
280
  Common.prototype.generateStoreKey = function (key) {
316
281
  return this.id + "-" + key;
@@ -393,7 +358,7 @@ var Common = /** @class */ (function () {
393
358
  this.pagenationPageInput.style.left = node.paginationData.targetPageLocal.x + 'px';
394
359
  this.pagenationPageInput.style.top = node.paginationData.targetPageLocal.y + 'px';
395
360
  this.pagenationPageInput.style.height = node.rect.height + 'px';
396
- this.store.parentElem.appendChild(this.pagenationPageInput);
361
+ this.parentElem.appendChild(this.pagenationPageInput);
397
362
  };
398
363
  // 展开分页列表
399
364
  Common.prototype.spreadPageListHandle = function (node, e) {
@@ -461,8 +426,8 @@ var Common = /** @class */ (function () {
461
426
  // 如果存在按钮组节点数据
462
427
  if (changeNode[node.id]) {
463
428
  for (let switchNode of Object.values(changeNode)) {
464
- if (this.store.data.pens[switchNode.tagOrder]) {
465
- this.store.data.pens[switchNode.tagOrder].activeImgeIndex = switchNode.id !== node.id;
429
+ if (this.data.pens[switchNode.tagOrder]) {
430
+ this.data.pens[switchNode.tagOrder].activeImgeIndex = switchNode.id !== node.id;
466
431
  }
467
432
  }
468
433
  }
@@ -481,23 +446,23 @@ var Common = /** @class */ (function () {
481
446
  Common.prototype.s8 = function () {
482
447
  return s8()
483
448
  };
484
- // Common.prototype.openSocket = function (url) {
485
- // this.closeSocket();
486
- // if (url || this.store.data.websocket) {
487
- // this.socket = new Socket(url || this.store.data.websocket, this.store.data);
488
- // }
489
- // };
490
- // Common.prototype.closeSocket = function () {
491
- // if (this.socket) {
492
- // this.socket.close();
493
- // }
494
- // };
449
+ Common.prototype.openSocket = function (url) {
450
+ this.closeSocket();
451
+ if (url || this.data.websocket) {
452
+ this.socket = new Socket(url || this.data.websocket, this.data);
453
+ }
454
+ };
455
+ Common.prototype.closeSocket = function () {
456
+ if (this.socket) {
457
+ this.socket.close();
458
+ }
459
+ };
495
460
  Common.prototype.openMqtt = function (url, options) {
496
461
  this.closeMqtt();
497
- if (url || this.store.data.mqttUrl) {
498
- url = url || this.store.data.mqttUrl;
499
- const mqttTopics = this.initData && this.initData.mqttTopics ? this.initData.mqttTopics : this.store.data.mqttTopics;
500
- options = options || this.store.data.mqttOptions
462
+ if (url || this.data.mqttUrl) {
463
+ url = url || this.data.mqttUrl;
464
+ const mqttTopics = this.initData && this.initData.mqttTopics ? this.initData.mqttTopics : this.data.mqttTopics;
465
+ options = options || this.data.mqttOptions
501
466
  let topics = mqttTopics
502
467
  this.isEnd = false;
503
468
  // let num = 0; // 记录推送的次数,用于判单丢失情况
@@ -505,7 +470,7 @@ var Common = /** @class */ (function () {
505
470
  var _this = this;
506
471
  this.mqttClient.on('message', function (topic, message) {
507
472
  //console.log('openMqtt11===================', topic, message)
508
- if (!_this.store.data.pens.length || !topic || topic != _this.store.data.mqttTopics) {
473
+ if (!_this.data.pens.length || !topic || topic != _this.data.mqttTopics) {
509
474
  return;
510
475
  }
511
476
  if (!this.isEnd) {
@@ -519,7 +484,7 @@ var Common = /** @class */ (function () {
519
484
  };
520
485
  Common.prototype.openPoll = function (message, val) {
521
486
  if (message) {
522
- this.poll = new POLL(this.store.data, message, val);
487
+ this.poll = new POLL(this.data, message, val);
523
488
  }
524
489
  };
525
490
  Common.prototype.clearInterValAll = function () {
@@ -547,10 +512,10 @@ var Common = /** @class */ (function () {
547
512
  this.inputObj = null;
548
513
  };
549
514
  Common.prototype.showInput = function (item) {
550
- if (this.store.data.locked ||
515
+ if (this.data.locked ||
551
516
  item.locked ||
552
517
  item.hideInput ||
553
- this.store.options.hideInput) {
518
+ this.options.hideInput) {
554
519
  return;
555
520
  }
556
521
  this.inputObj = item;
@@ -569,9 +534,9 @@ var Common = /** @class */ (function () {
569
534
  this.input.focus();
570
535
  };
571
536
  Common.prototype.getRect = function (pens) {
572
- if (!this.store || !this.store.data) return;
537
+ if (!this.data) return;
573
538
  if (!pens) {
574
- pens = this.store.data.pens;
539
+ pens = this.data.pens;
575
540
  }
576
541
  return getRect(pens);
577
542
  };
@@ -589,7 +554,7 @@ var Common = /** @class */ (function () {
589
554
  }
590
555
  var offsetX = x - this.lastTranlated.x;
591
556
  var offsetY = y - this.lastTranlated.y;
592
- for (var _i = 0, _a = this.store.data.pens; _i < _a.length; _i++) {
557
+ for (var _i = 0, _a = this.data.pens; _i < _a.length; _i++) {
593
558
  var item = _a[_i];
594
559
  item.translate(offsetX, offsetY);
595
560
  }
@@ -608,7 +573,7 @@ var Common = /** @class */ (function () {
608
573
  var viewCenter = this.getViewCenter(padding);
609
574
  var center = rect.center;
610
575
  this.translate(viewCenter.x - center.x, viewCenter.y - center.y);
611
- var parentElem = this.store.parentElem;
576
+ var parentElem = this.canvas.parentElem;
612
577
  var x = (parentElem.scrollWidth - parentElem.offsetWidth) / 2;
613
578
  var y = (parentElem.scrollHeight - parentElem.offsetHeight) / 2;
614
579
  parentElem.scrollTo(x, y);
@@ -619,7 +584,7 @@ var Common = /** @class */ (function () {
619
584
  return !(rect.width === 99999 || rect.height === 99999);
620
585
  };
621
586
  Common.prototype.getViewCenter = function (viewPadding) {
622
- var padding = formatPadding(viewPadding || this.store.options.viewPadding);
587
+ var padding = formatPadding(viewPadding || this.options.viewPadding);
623
588
  var _a = this.canvas, width = _a.width, height = _a.height;
624
589
  return {
625
590
  x: (width - padding[1] - padding[3]) / 2 + padding[3],
@@ -683,7 +648,7 @@ var Common = /** @class */ (function () {
683
648
  }
684
649
  var tipMarkdownMarginLeft = count * 3 + 11
685
650
 
686
- var parentRect = this.store.parentElem.getBoundingClientRect();
651
+ var parentRect = this.parentElem.getBoundingClientRect();
687
652
  var elemRect = elem.getBoundingClientRect();
688
653
  var x = parentRect.left + dataRect.x;
689
654
  var y = pos.y + parentRect.top;
@@ -691,8 +656,8 @@ var Common = /** @class */ (function () {
691
656
  x = x + dataRect.width / 2 - tipMarkdownMarginLeft
692
657
  y = parentRect.top + dataRect.ey - dataRect.height - 46
693
658
  }
694
- x -= this.store.parentElem.scrollLeft;
695
- y -= this.store.parentElem.scrollTop;
659
+ x -= this.parentElem.scrollLeft;
660
+ y -= this.parentElem.scrollTop;
696
661
  if (x < 0) {
697
662
  x = 0;
698
663
  }
@@ -724,11 +689,10 @@ var Common = /** @class */ (function () {
724
689
  this.tip = '';
725
690
  };
726
691
  Common.prototype.dispatch = function (event, data) {
727
- if(!this.store || !this.store.options) return;
728
- if (this.store.options.on) {
729
- this.store.options.on(event, data);
692
+ if (this.options.on) {
693
+ this.options.on(event, data);
730
694
  }
731
- if (event === 'node' && data.name == 'tablePagination' && this.store.options.type !== 'topology') {
695
+ if (event === 'node' && data.name == 'tablePagination' && this.options.type !== 'topology') {
732
696
  const tableNodes = Store.get('FORM:tableData').data.tableNodes[data.paginationData.bindFromTableId];
733
697
  const pageSize = data.paginationData.pageSize;
734
698
  const offset = (parseInt(data.paginationData.pageNumber) - 1) * pageSize;
@@ -754,7 +718,7 @@ var Common = /** @class */ (function () {
754
718
  }
755
719
  this.initType = type
756
720
  this.initData = data
757
- const canvasData = data ? data : this.store.data
721
+ const canvasData = data ? data : this.data
758
722
  //this.topologyDetailData = initData
759
723
  const url = canvasData.mqttUrl
760
724
  // if(url && url.indexOf('://') > -1){
@@ -794,7 +758,7 @@ var Common = /** @class */ (function () {
794
758
  };
795
759
  Common.prototype.initTagParams = async function (eventType) {
796
760
  this.clearTagParams(eventType)
797
- const pensData = this.store.data.pens
761
+ const pensData = this.data.pens
798
762
  let tagParams = this.getTagParams(pensData, eventType);
799
763
  // 详情页面,即URL配置了资产id的页面
800
764
  let assetId = this.getUrlParams('assetId')
@@ -808,7 +772,7 @@ var Common = /** @class */ (function () {
808
772
  if (this.assetPoperties) {
809
773
  // 更新画布上固定的资产详情对应的值
810
774
  //const canvasPens = this.pathRewrite ? canvasData.pens : this.canvas.data.pens
811
- this.renderForAssetPoperties(pensData);
775
+ this.renderForAssetPoperties(this.canvas.data.pens);
812
776
  }
813
777
  }
814
778
  };
@@ -882,18 +846,18 @@ var Common = /** @class */ (function () {
882
846
  }
883
847
  };
884
848
  Common.prototype.getMqttData = async function (tagParams, panelData) {
885
- let ret = null;
849
+ let ret = {};
886
850
  let data = {};
887
851
  let path = '';
888
852
  let assetData = null;
889
853
  let pathRewrite = this.pathRewrite;
890
- let canvasData = JSON.parse(JSON.stringify(this.store.data));
891
- let mqttTopics = this.store.data.mqttTopics;
854
+ let canvasData = JSON.parse(JSON.stringify(this.canvas.data));
855
+ let mqttTopics = this.data.mqttTopics;
892
856
  let tagParamsData = tagParams;
893
857
  let detailJson = null;
894
858
  Store.set('TIMEOUT:currentPage', `locationPath${this.s8()}`);
895
859
  if (panelData) {
896
- this.store.data.mqttTopics = mqttTopics
860
+ this.data.mqttTopics = mqttTopics
897
861
  pathRewrite = panelData.pathRewrite;
898
862
  canvasData = JSON.parse(JSON.stringify(panelData.data));
899
863
  mqttTopics = panelData.mqttTopics;
@@ -929,14 +893,7 @@ var Common = /** @class */ (function () {
929
893
  this.theData = data
930
894
  }
931
895
  let drawedData = null
932
- data.cancelToken = this.mqttDataSouse.token;
933
- ret = await axios.post(path, data).catch(function(th) {
934
- if(axios.isCancel(th)) {
935
- console.log('请求取消了----', th.message);
936
- } else {
937
- console.log('请求失败----')
938
- }
939
- });
896
+ ret = await axios.post(path, data);
940
897
  if (ret.data && ret.data.data) {
941
898
  if (assetData) ret.data.data.asset = assetData
942
899
  drawedData = this.mqttDataDrawing(canvasData, ret.data.data, detailJson)
@@ -963,7 +920,7 @@ var Common = /** @class */ (function () {
963
920
  // console.log('收到消息', syncData)
964
921
  Store.set('mqtt:responseData', syncData);
965
922
  data.pens.map((item) => {
966
- if (item.children && item.children.length) {
923
+ if (item.children != undefined) {
967
924
  item.children.map((_item) => {
968
925
  item.defaultFillStyle = item.fillStyle;
969
926
  item.defaultFontColor = item.font.color;
@@ -1112,11 +1069,11 @@ var Common = /** @class */ (function () {
1112
1069
  }
1113
1070
  };
1114
1071
  Common.prototype.onMqttContent = async function (tagParams) {
1115
- if (!this.initType) this.store.data.mqttTopics = 'mqtt-' + s8();
1072
+ if (!this.initType) this.data.mqttTopics = 'mqtt-' + s8();
1116
1073
  // 告知MQTT属性中数据的集合
1117
1074
  const ret = !this.initType ? await this.getMqttData(tagParams) : this.initType;
1118
1075
  if (ret) {
1119
- let mqttUrlStr = this.store.data.mqttUrl, mqttOption = this.store.data.mqttOptions
1076
+ let mqttUrlStr = this.data.mqttUrl, mqttOption = this.data.mqttOptions
1120
1077
  if (this.initData) {
1121
1078
  const {mqttUrl, mqttOptions} = this.initData
1122
1079
  mqttUrlStr = mqttUrl
@@ -1132,8 +1089,8 @@ var Common = /** @class */ (function () {
1132
1089
  const index = eventType[4] ? eventType[4] : ''
1133
1090
  // const url = 'pollUrl'+index;
1134
1091
  // const second = 'pollSecond'+index;
1135
- const pollUrl = this.store.data['pollUrl' + index]
1136
- const pollSecond = this.store.data['pollSecond' + index]
1092
+ const pollUrl = this.data['pollUrl' + index]
1093
+ const pollSecond = this.data['pollSecond' + index]
1137
1094
  this.onpollStop(eventType);
1138
1095
  if (pollUrl && pollSecond) {
1139
1096
  this.renderForPoll(tagParams, pollUrl, eventType);
@@ -1180,7 +1137,7 @@ var Common = /** @class */ (function () {
1180
1137
  this.getMqttData(this.tagParams.Mqtt);
1181
1138
  };
1182
1139
  Common.prototype.doMqttDrow = function (ret) {
1183
- let canvasData = this.store.data;
1140
+ let canvasData = this.canvas.data;
1184
1141
  ret = JSON.parse(ret);
1185
1142
  // console.log('处理消息')
1186
1143
  // console.log('this.canvas.data',this.canvas.data)
@@ -1198,11 +1155,11 @@ var Common = /** @class */ (function () {
1198
1155
  Common.prototype.hidePenVal = function (pen, val) {
1199
1156
  const tags = pen.tags
1200
1157
  const obj = val ? JSON.parse(val) : {}
1201
- const visibleRange = obj.visibleRange ? obj.visibleRange.trim() : ''
1202
- const visibleFnRange = obj.visibleFnRange ? obj.visibleFnRange.trim() : ''
1203
- const visibleValue = obj.visibleValue ? obj.visibleValue.trim() : ''
1204
- const hiddenRange = obj.hiddenRange ? obj.hiddenRange.trim() : ''
1205
- const tabsValue = obj.tabsValue ? obj.tabsValue.trim() : ''
1158
+ const visibleRange = obj.visibleRange
1159
+ const visibleFnRange = obj.visibleFnRange
1160
+ const visibleValue = obj.visibleValue
1161
+ const hiddenRange = obj.hiddenRange
1162
+ const tabsValue = obj.tabsValue
1206
1163
  if (tags.length > 0) {
1207
1164
  if (visibleRange == '1') {
1208
1165
  if (this.openCount % 2 == 0) {
@@ -1243,13 +1200,10 @@ var Common = /** @class */ (function () {
1243
1200
  this.render();
1244
1201
  };
1245
1202
  Common.prototype.destroyStatic = function () {
1246
- this.mqttDataSouse.cancel();
1247
- this.clear('destroy');
1248
1203
  this.clearInterValAll();
1249
- //this.closeSocket();
1204
+ this.closeSocket();
1250
1205
  this.closeMqtt();
1251
1206
  this.closePoll();
1252
- cancelAnimationFrame(this.renderTimer);
1253
1207
  this.subcribe.unsubscribe();
1254
1208
  this.subcribeRender.unsubscribe();
1255
1209
  this.subcribeImage.unsubscribe();
@@ -1263,7 +1217,7 @@ var Common = /** @class */ (function () {
1263
1217
  this.canvas = null;
1264
1218
  this.offscreen.destroy();
1265
1219
  this.offscreen = null;
1266
- this.store.parentElem = null;
1220
+ this.data = null;
1267
1221
  Store.set('form:tableData', null);
1268
1222
  Store.set('TIMEOUT:currentPage', `empty${this.s8()}`);
1269
1223
  Store.set('FORM:tableData', {
@@ -1,18 +1,19 @@
1
1
  // @ts-ignore
2
2
  import { EventType, Handler } from 'mitt';
3
3
  import {Options, Padding} from './options';
4
- import { Pen, Node, Point, Line } from './models';
4
+ import { Pen, Node, Point, Line, TopologyData } from './models';
5
5
  import { HoverLayer } from './hoverLayer';
6
6
  import { ActiveLayer } from './activeLayer';
7
+ import { DivLayer } from './divLayer';
7
8
  import { Rect } from './models';
8
9
  import {Common} from './common';
9
10
  interface ICaches {
10
11
  index: number;
11
- list: [];
12
+ list: TopologyData[];
12
13
  }
13
14
  export declare class Topology extends Common{
14
15
  constructor(parent: string | HTMLElement, options?: Options);
15
- clipboard: {};
16
+ clipboard: TopologyData;
16
17
  caches: ICaches;
17
18
  private subcribeAnimateMoved;
18
19
  private subcribeMediaEnd;