dcim-topology2d 2.0.7 → 3.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (204) 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/index.d.ts +1 -3
  17. package/chart-diagram/index.js +1 -2
  18. package/chart-diagram/src/echarts/index.d.ts +2 -1
  19. package/chart-diagram/src/echarts/index.js +104 -106
  20. package/chart-diagram/src/register.js +8 -9
  21. package/class-diagram/src/class/class.d.ts +1 -1
  22. package/class-diagram/src/class/class.rect.d.ts +1 -1
  23. package/class-diagram/src/class/class.rect.js +1 -1
  24. package/class-diagram/src/register.js +1 -1
  25. package/core/index.d.ts +0 -2
  26. package/core/index.js +0 -2
  27. package/core/src/activeLayer.d.ts +10 -2
  28. package/core/src/activeLayer.js +47 -42
  29. package/core/src/animateLayer.d.ts +7 -3
  30. package/core/src/animateLayer.js +12 -10
  31. package/core/src/calling.d.ts +4 -1
  32. package/core/src/calling.js +41 -43
  33. package/core/src/canvas.d.ts +6 -1
  34. package/core/src/canvas.js +18 -18
  35. package/core/src/common.d.ts +7 -6
  36. package/core/src/common.js +672 -333
  37. package/core/src/core.d.ts +4 -3
  38. package/core/src/core.js +367 -466
  39. package/core/src/divLayer.d.ts +36 -2
  40. package/core/src/divLayer.js +305 -33
  41. package/core/src/healps/changeData.d.ts +2 -1
  42. package/core/src/healps/changeData.js +66 -32
  43. package/core/src/hoverLayer.d.ts +9 -2
  44. package/core/src/hoverLayer.js +34 -31
  45. package/core/src/middles/default.d.ts +3 -1
  46. package/core/src/middles/default.js +51 -53
  47. package/core/src/middles/index.js +2 -3
  48. package/core/src/middles/nodes/arbitrarygraph.js +9 -11
  49. package/core/src/middles/nodes/pentagon.rect.js +1 -1
  50. package/core/src/middles/nodes/rectangle.rect.js +1 -1
  51. package/core/src/models/data.d.ts +26 -0
  52. package/core/src/models/data.js +77 -0
  53. package/core/src/models/data.js.map +1 -0
  54. package/core/src/models/index.d.ts +1 -0
  55. package/core/src/models/index.js +1 -0
  56. package/core/src/models/node.d.ts +0 -10
  57. package/core/src/models/node.js +32 -54
  58. package/core/src/models/pen.js +59 -19
  59. package/core/src/models/rect.js +2 -2
  60. package/core/src/mqtt.d.ts +14 -0
  61. package/core/src/mqtt.js +82 -0
  62. package/core/src/mqtt.js.map +1 -0
  63. package/core/src/offscreen.d.ts +4 -1
  64. package/core/src/offscreen.js +8 -10
  65. package/core/src/options.d.ts +1 -3
  66. package/core/src/options.js +0 -2
  67. package/core/src/poll.js +39 -0
  68. package/core/src/preview.d.ts +13 -1
  69. package/core/src/preview.js +43 -111
  70. package/core/src/renderLayer.d.ts +9 -11
  71. package/core/src/renderLayer.js +60 -48
  72. package/core/src/socket.d.ts +10 -0
  73. package/core/src/socket.js +51 -0
  74. package/core/src/socket.js.map +1 -0
  75. package/core/src/utils/canvas.js +1 -1
  76. package/core/src/utils/construction.d.ts +3 -12
  77. package/core/src/utils/construction.js +1 -8
  78. package/core/src/utils/conversion.d.ts +0 -11
  79. package/core/src/utils/conversion.js +0 -167
  80. package/core/src/utils/dom.d.ts +8 -0
  81. package/core/src/utils/dom.js +67 -0
  82. package/core/src/utils/dom.js.map +1 -0
  83. package/core/src/utils/index.d.ts +1 -2
  84. package/core/src/utils/index.js +1 -2
  85. package/core/src/utils/math.d.ts +0 -1
  86. package/core/src/utils/math.js +0 -3
  87. package/core/src/utils/onmousevent.d.ts +0 -3
  88. package/core/src/utils/onmousevent.js +8 -37
  89. package/flow-diagram/src/comment/comment.anchor.d.ts +1 -1
  90. package/flow-diagram/src/comment/comment.anchor.js +1 -1
  91. package/flow-diagram/src/comment/comment.d.ts +1 -1
  92. package/flow-diagram/src/data/data.anchor.d.ts +1 -1
  93. package/flow-diagram/src/data/data.anchor.js +1 -1
  94. package/flow-diagram/src/data/data.d.ts +1 -1
  95. package/flow-diagram/src/data/data.rect.d.ts +1 -1
  96. package/flow-diagram/src/data/data.rect.js +1 -1
  97. package/flow-diagram/src/db/db.d.ts +1 -1
  98. package/flow-diagram/src/db/db.rect.d.ts +1 -1
  99. package/flow-diagram/src/db/db.rect.js +1 -1
  100. package/flow-diagram/src/display/display.anchor.d.ts +1 -1
  101. package/flow-diagram/src/display/display.anchor.js +1 -1
  102. package/flow-diagram/src/display/display.d.ts +1 -1
  103. package/flow-diagram/src/display/display.rect.d.ts +1 -1
  104. package/flow-diagram/src/display/display.rect.js +1 -1
  105. package/flow-diagram/src/document/document.anchor.d.ts +1 -1
  106. package/flow-diagram/src/document/document.anchor.js +1 -1
  107. package/flow-diagram/src/document/document.d.ts +1 -1
  108. package/flow-diagram/src/document/document.rect.d.ts +1 -1
  109. package/flow-diagram/src/document/document.rect.js +1 -1
  110. package/flow-diagram/src/externStorage/externStorage.anchor.d.ts +1 -1
  111. package/flow-diagram/src/externStorage/externStorage.anchor.js +1 -1
  112. package/flow-diagram/src/externStorage/externStorage.d.ts +1 -1
  113. package/flow-diagram/src/externStorage/externStorage.rect.d.ts +1 -1
  114. package/flow-diagram/src/externStorage/externStorage.rect.js +1 -1
  115. package/flow-diagram/src/internalStorage/internalStorage.d.ts +1 -1
  116. package/flow-diagram/src/internalStorage/internalStorage.rect.d.ts +1 -1
  117. package/flow-diagram/src/internalStorage/internalStorage.rect.js +1 -1
  118. package/flow-diagram/src/manually/manually.anchor.d.ts +1 -1
  119. package/flow-diagram/src/manually/manually.anchor.js +1 -1
  120. package/flow-diagram/src/manually/manually.d.ts +1 -1
  121. package/flow-diagram/src/manually/manually.rect.d.ts +1 -1
  122. package/flow-diagram/src/manually/manually.rect.js +1 -1
  123. package/flow-diagram/src/parallel/parallel.anchor.d.ts +1 -1
  124. package/flow-diagram/src/parallel/parallel.anchor.js +1 -1
  125. package/flow-diagram/src/parallel/parallel.d.ts +1 -1
  126. package/flow-diagram/src/queue/queue.d.ts +1 -1
  127. package/flow-diagram/src/queue/queue.rect.d.ts +1 -1
  128. package/flow-diagram/src/queue/queue.rect.js +1 -1
  129. package/flow-diagram/src/register.js +1 -1
  130. package/flow-diagram/src/subprocess/subprocess.d.ts +1 -1
  131. package/flow-diagram/src/subprocess/subprocess.rect.d.ts +1 -1
  132. package/flow-diagram/src/subprocess/subprocess.rect.js +1 -1
  133. package/layout/src/align.d.ts +1 -1
  134. package/layout/src/align.js +1 -1
  135. package/layout/src/layout.d.ts +1 -1
  136. package/layout/src/layout.js +1 -1
  137. package/myShape-diagram/{index.js → myShape.js} +1 -4
  138. package/package.json +1 -1
  139. package/sequence-diagram/src/focus/focus.anchor.d.ts +1 -1
  140. package/sequence-diagram/src/focus/focus.anchor.js +1 -1
  141. package/sequence-diagram/src/focus/focus.d.ts +1 -1
  142. package/sequence-diagram/src/focus/focus.rect.d.ts +1 -1
  143. package/sequence-diagram/src/focus/focus.rect.js +1 -1
  144. package/sequence-diagram/src/lifeline/lifeline.anchor.d.ts +1 -1
  145. package/sequence-diagram/src/lifeline/lifeline.anchor.js +1 -1
  146. package/sequence-diagram/src/lifeline/lifeline.d.ts +1 -1
  147. package/sequence-diagram/src/lifeline/lifeline.rect.d.ts +1 -1
  148. package/sequence-diagram/src/lifeline/lifeline.rect.js +1 -1
  149. package/sequence-diagram/src/register.js +1 -1
  150. package/chart-diagram/src/utils/changeOptions.d.ts +0 -7
  151. package/chart-diagram/src/utils/changeOptions.js +0 -253
  152. package/chart-diagram/src/utils/conversion.d.ts +0 -18
  153. package/chart-diagram/src/utils/conversion.js +0 -399
  154. package/chart-diagram/src/utils/drawGraphic.d.ts +0 -3
  155. package/chart-diagram/src/utils/drawGraphic.js +0 -97
  156. package/chart-diagram/src/utils/formatter.d.ts +0 -1
  157. package/chart-diagram/src/utils/formatter.js +0 -129
  158. package/chart-diagram/src/utils/index.d.ts +0 -4
  159. package/chart-diagram/src/utils/index.js +0 -4
  160. package/chart-diagram/src/utils/render.d.ts +0 -8
  161. package/chart-diagram/src/utils/render.js +0 -199
  162. package/core/src/element/common.d.ts +0 -5
  163. package/core/src/element/common.js +0 -54
  164. package/core/src/element/iframe.d.ts +0 -3
  165. package/core/src/element/iframe.js +0 -12
  166. package/core/src/element/index.d.ts +0 -4
  167. package/core/src/element/index.js +0 -4
  168. package/core/src/element/select.d.ts +0 -11
  169. package/core/src/element/select.js +0 -263
  170. package/core/src/element/tab.d.ts +0 -1
  171. package/core/src/element/tab.js +0 -23
  172. package/core/src/middles/arrows/index.d.ts +0 -4
  173. package/core/src/middles/arrows/index.js +0 -5
  174. package/core/src/middles/lines/index.d.ts +0 -4
  175. package/core/src/middles/lines/index.js +0 -5
  176. package/core/src/middles/nodes/formoverflow.js +0 -61
  177. package/core/src/middles/nodes/formselect.d.ts +0 -2
  178. package/core/src/middles/nodes/formselect.js +0 -95
  179. package/core/src/middles/nodes/iframe.d.ts +0 -2
  180. package/core/src/middles/nodes/iframe.js +0 -29
  181. package/core/src/middles/nodes/index.d.ts +0 -48
  182. package/core/src/middles/nodes/index.js +0 -49
  183. package/core/src/store/common.d.ts +0 -9
  184. package/core/src/store/common.js +0 -5
  185. package/core/src/store/data.d.ts +0 -186
  186. package/core/src/store/data.js +0 -178
  187. package/core/src/store/index.d.ts +0 -2
  188. package/core/src/store/index.js +0 -2
  189. package/core/src/utils/assignment.d.ts +0 -6
  190. package/core/src/utils/assignment.js +0 -168
  191. package/core/src/utils/params.d.ts +0 -2
  192. package/core/src/utils/params.js +0 -60
  193. package/static/echartsDefaultData.js +0 -167
  194. package/static/element.js +0 -14
  195. package/static/form.js +0 -11
  196. package/static/index.js +0 -3
  197. package/store/actions.js +0 -1
  198. package/store/clear.js +0 -10
  199. package/store/index.js +0 -2
  200. package/style/common.css +0 -18
  201. package/style/editor.css +0 -13
  202. package/style/index.css +0 -4
  203. package/style/select.css +0 -143
  204. /package/myShape-diagram/{index.ts → myShape.ts} +0 -0
package/core/src/core.js CHANGED
@@ -16,22 +16,10 @@ import { Common } from './common'
16
16
  import {HoverLayer} from './hoverLayer';
17
17
  import {ActiveLayer} from './activeLayer';
18
18
  import {KeyType, KeydownType} from './options';
19
- import {PenType, Node, Point, Line, Lock, AnchorMode, Rect} from './models';
19
+ import {PenType, Node, Point, Line, TopologyData, Lock, AnchorMode, Rect} from './models';
20
20
  import {drawNodeFns, drawLineFns} from './middles/index';
21
- import {
22
- s8,
23
- pointInRect,
24
- formatPadding,
25
- setTagIdData,
26
- setKpiAddrData,
27
- setAssetIdData,
28
- setAreaIdData,
29
- setVarValueData,
30
- setThreeCategoryIdData,
31
- setConnectionTagForConf
32
- } from './utils';
33
- import {setSelectElementPosition} from './element';
34
- import {elementType} from '../../static';
21
+ import { s8, pointInRect, formatPadding, previewType} from './utils';
22
+ import axios from 'axios'
35
23
 
36
24
  var resizeCursors = ['nw-resize', 'ne-resize', 'se-resize', 'sw-resize'];
37
25
  var dockOffset = 10;
@@ -39,8 +27,8 @@ var Topology = (function (_super) {
39
27
  __extends(Topology, _super);
40
28
  function Topology(parent, options) {
41
29
  var _this = _super.call(this, parent, options) || this;
42
- _this.hoverLayer = new HoverLayer(_this.id);
43
- _this.activeLayer = new ActiveLayer(_this.id);
30
+ _this.hoverLayer = new HoverLayer(this.options, _this.id);
31
+ _this.activeLayer = new ActiveLayer(this.options, _this.id);
44
32
  _this.offscreen.getRoutineLayer();
45
33
  _this.activeLayer.topology = this;
46
34
  _this.gridElem = document.createElement('div');
@@ -62,7 +50,7 @@ var Topology = (function (_super) {
62
50
  if (Store.get('addingArbitraryGraph')) {
63
51
  return
64
52
  }
65
- if (_this.scheduledAnimationFrame || _this.store.data.locked === Lock.NoEvent) {
53
+ if (_this.scheduledAnimationFrame || _this.data.locked === Lock.NoEvent) {
66
54
  return;
67
55
  }
68
56
  // https://caniuse.com/#feat=mdn-api_mouseevent_buttons
@@ -73,7 +61,7 @@ var Topology = (function (_super) {
73
61
  }
74
62
  if (_this.mouseDown) {
75
63
  var b = false;
76
- switch (_this.store.options.translateKey) {
64
+ switch (_this.options.translateKey) {
77
65
  case KeyType.None:
78
66
  b = true;
79
67
  break;
@@ -108,7 +96,7 @@ var Topology = (function (_super) {
108
96
  return false;
109
97
  }
110
98
  }
111
- if (_this.store.data.locked && _this.mouseDown) {
99
+ if (_this.data.locked && _this.mouseDown) {
112
100
  return;
113
101
  }
114
102
  _this.scheduledAnimationFrame = true;
@@ -162,18 +150,18 @@ var Topology = (function (_super) {
162
150
  return;
163
151
  }
164
152
  // Move out parent element.
165
- var moveOutX = pos.x + 50 > _this.store.parentElem.clientWidth + _this.store.parentElem.scrollLeft;
166
- var moveOutY = pos.y + 50 > _this.store.parentElem.clientHeight + _this.store.parentElem.scrollTop;
167
- if (!_this.store.options.disableMoveOutParent && (moveOutX || moveOutY)) {
153
+ var moveOutX = pos.x + 50 > _this.parentElem.clientWidth + _this.parentElem.scrollLeft;
154
+ var moveOutY = pos.y + 50 > _this.parentElem.clientHeight + _this.parentElem.scrollTop;
155
+ if (!_this.options.disableMoveOutParent && (moveOutX || moveOutY)) {
168
156
  _this.dispatch('moveOutParent', pos);
169
- if (_this.store.options.autoExpandDistance > 0) {
157
+ if (_this.options.autoExpandDistance > 0) {
170
158
  var resize = false;
171
159
  if (pos.x + 50 > _this.divLayer.canvas.clientWidth) {
172
- _this.canvas.width += _this.store.options.autoExpandDistance;
160
+ _this.canvas.width += _this.options.autoExpandDistance;
173
161
  resize = true;
174
162
  }
175
163
  if (pos.y + 50 > _this.divLayer.canvas.clientHeight) {
176
- _this.canvas.height += _this.store.options.autoExpandDistance;
164
+ _this.canvas.height += _this.options.autoExpandDistance;
177
165
  resize = true;
178
166
  }
179
167
  if (resize) {
@@ -182,21 +170,20 @@ var Topology = (function (_super) {
182
170
  height: _this.canvas.height,
183
171
  });
184
172
  }
185
- _this.scroll(moveOutX ? _this.store.options.autoExpandDistance / 2 : 0, moveOutY ? _this.store.options.autoExpandDistance / 2 : 0);
173
+ _this.scroll(moveOutX ? _this.options.autoExpandDistance / 2 : 0, moveOutY ? _this.options.autoExpandDistance / 2 : 0);
186
174
  }
187
175
  }
188
- var moveLeft = pos.x - 100 < _this.store.parentElem.scrollLeft;
189
- var moveTop = pos.y - 100 < _this.store.parentElem.scrollTop;
176
+ var moveLeft = pos.x - 100 < _this.parentElem.scrollLeft;
177
+ var moveTop = pos.y - 100 < _this.parentElem.scrollTop;
190
178
  if ((moveLeft || moveTop)) {
191
179
  _this.scroll(moveLeft ? -100 : 0, moveTop ? -100 : 0);
192
180
  }
193
- //console.log('_this.moveIn.type----', _this.moveIn.type)
181
+ // console.log('_this.moveIn.type----', _this.moveIn.type)
194
182
  switch (_this.moveIn.type) {
195
183
  case _this.moveInType.None:
196
184
  _this.hoverLayer.dragRect = new Rect(_this.mouseDown.x, _this.mouseDown.y, pos.x - _this.mouseDown.x, pos.y - _this.mouseDown.y);
197
185
  break;
198
186
  case _this.moveInType.Nodes:
199
- _this.store.data.dataResize = 0;
200
187
  if (_this.activeLayer.locked()) {
201
188
  break;
202
189
  }
@@ -207,15 +194,8 @@ var Topology = (function (_super) {
207
194
  _this.activeLayer.move(offset.x ? offset.x : x, offset.y ? offset.y : y);
208
195
  _this.needCache = true;
209
196
  }
210
- const dropdownSelect = _this.activeLayer.pens.filter((ds) => {return ds.name === elementType.select && ds.selectDropdown});
211
- if(dropdownSelect.length) {
212
- dropdownSelect.map((dropdown) => {
213
- setSelectElementPosition(dropdown);
214
- })
215
- }
216
197
  break;
217
198
  case _this.moveInType.ResizeCP:
218
- _this.store.data.dataResize = 1;
219
199
  var p1 = new Point(_this.mouseDown.x, _this.mouseDown.y);
220
200
  var p2 = new Point(pos.x, pos.y);
221
201
  var offsetX = p2.x - p1.x;
@@ -263,11 +243,8 @@ var Topology = (function (_super) {
263
243
  }
264
244
  }
265
245
  } else {
266
- const activeLayerPens = _this.activeLayer.pens;
267
- const isOnlySelect = activeLayerPens.length < 2 && activeLayerPens[0].name === elementType.select && activeLayerPens[0].selectDropdown;
268
- if(isOnlySelect) setSelectElementPosition(activeLayerPens[0]);
269
246
  _this.activeLayer.resize(_this.moveIn.activeAnchorIndex, _this.mouseDown, pos);
270
- _this.dispatch('resizePens', activeLayerPens);
247
+ _this.dispatch('resizePens', _this.activeLayer.pens);
271
248
  _this.needCache = true;
272
249
  }
273
250
  break;
@@ -308,7 +285,7 @@ var Topology = (function (_super) {
308
285
 
309
286
  } else {
310
287
 
311
- var arrow = _this.store.data.toArrowType;
288
+ var arrow = _this.data.toArrowType;
312
289
  if (_this.moveIn.hoverLine) {
313
290
  arrow = _this.moveIn.hoverLine.toArrow;
314
291
  }
@@ -362,7 +339,6 @@ var Topology = (function (_super) {
362
339
  });
363
340
  };
364
341
  _this.onmousedown = function (e) {
365
- _this.store.data.dataResize = 0;
366
342
  if (e.button !== 0)
367
343
  return;
368
344
  var canvasPos = _this.divLayer.canvas.getBoundingClientRect();
@@ -399,7 +375,7 @@ var Topology = (function (_super) {
399
375
  break;
400
376
  case _this.moveInType.LineMove:
401
377
  _this.hoverLayer.initLine = new Line(_this.moveIn.hoverLine);
402
- if (_this.store.data.locked || _this.moveIn.hoverLine.locked) {
378
+ if (_this.data.locked || _this.moveIn.hoverLine.locked) {
403
379
  _this.moveIn.hoverLine.click();
404
380
  }
405
381
  // tslint:disable-next-line:no-switch-case-fall-through
@@ -417,12 +393,12 @@ var Topology = (function (_super) {
417
393
 
418
394
  } else {
419
395
  _this.hoverLayer.line = _this.addLine({
420
- name: _this.store.data.lineName,
396
+ name: _this.data.lineName,
421
397
  from: new Point(_this.moveIn.hoverNode.rotatedAnchors[_this.moveIn.hoverAnchorIndex].x, _this.moveIn.hoverNode.rotatedAnchors[_this.moveIn.hoverAnchorIndex].y, _this.moveIn.hoverNode.rotatedAnchors[_this.moveIn.hoverAnchorIndex].direction, _this.moveIn.hoverAnchorIndex, _this.moveIn.hoverNode.id),
422
- fromArrow: _this.store.data.fromArrowType,
398
+ fromArrow: _this.data.fromArrowType,
423
399
  to: new Point(_this.moveIn.hoverNode.rotatedAnchors[_this.moveIn.hoverAnchorIndex].x, _this.moveIn.hoverNode.rotatedAnchors[_this.moveIn.hoverAnchorIndex].y),
424
- toArrow: _this.store.data.toArrowType,
425
- strokeStyle: _this.store.options.color,
400
+ toArrow: _this.data.toArrowType,
401
+ strokeStyle: _this.options.color,
426
402
  });
427
403
  _this.dispatch('anchor', {
428
404
  anchor: _this.moveIn.hoverNode.rotatedAnchors[_this.moveIn.hoverAnchorIndex],
@@ -465,9 +441,10 @@ var Topology = (function (_super) {
465
441
  const activeNode = _this.moveIn.activeNode;
466
442
  if (!_this.checkNodeOfClickType(activeNode)) {
467
443
  _this.activeLayer.setPens([activeNode]);
468
- if(activeNode.name === elementType.select && activeNode.selectDropdown) setSelectElementPosition(activeNode, 'down');
469
- if(activeNode.name == 'tablePagination') {
470
- if (_this.store.options.type === 'topology') return _this.dispatch('node', activeNode);
444
+ if (activeNode && activeNode.name == 'arbitraryGraph') {
445
+ _this.dispatch('node', activeNode);
446
+ } else if (activeNode && activeNode.name == 'tablePagination') {
447
+ if (_this.options.type === 'topology') return _this.dispatch('node', activeNode);
471
448
  const pnlKeys = Object.keys(activeNode.paginationData.pageNumberLocals);
472
449
  const pageNumArea = pnlKeys.find((pna) => {
473
450
  return e.offsetX - 32 < pna && e.offsetX - parseInt(pna) > 0
@@ -480,12 +457,20 @@ var Topology = (function (_super) {
480
457
  if (activeNode.paginationData.pageListState) _this.spreadPageListHandle(activeNode, e);
481
458
  if (activeNode.paginationData.targetPageLocal.hide) _this.targetPageInputHandle(activeNode, e);
482
459
  }
483
- }else {
460
+ } else {
484
461
  _this.dispatch('node', activeNode);
462
+ if(!window.location.pathname.includes('workspace')) {
463
+ const staticTypeNode = activeNode.events.find((ev) => {
464
+ return parseInt(ev.action) === 8
465
+ }); // 若绑定的是echarts统计图事件
466
+ if (staticTypeNode) {
467
+ _this.switchStaticsCheckType(activeNode, staticTypeNode);
468
+ }
469
+ }
485
470
  }
486
471
  }
487
472
  }
488
- if (_this.store.data.locked || _this.moveIn.activeNode.locked) {
473
+ if (_this.data.locked || _this.moveIn.activeNode.locked) {
489
474
  _this.moveIn.activeNode.click();
490
475
  }
491
476
  break;
@@ -526,10 +511,10 @@ var Topology = (function (_super) {
526
511
  if (_this.hoverLayer.line) {
527
512
  var willAddLine = void 0;
528
513
  if (_this.hoverLayer.line.to.id) {
529
- if (!_this.store.options.disableRepeatLine) {
514
+ if (!_this.options.disableRepeatLine) {
530
515
  willAddLine = true;
531
516
  } else {
532
- var lines = _this.store.data.pens.filter(function (pen) {
517
+ var lines = _this.data.pens.filter(function (pen) {
533
518
  return pen.type === PenType.Line &&
534
519
  pen.from.isSameAs(_this.hoverLayer.line.from) &&
535
520
  pen.to.isSameAs(_this.hoverLayer.line.to);
@@ -537,13 +522,13 @@ var Topology = (function (_super) {
537
522
  willAddLine = lines.length <= 1;
538
523
  }
539
524
  } else {
540
- willAddLine = !_this.store.options.disableEmptyLine;
525
+ willAddLine = !_this.options.disableEmptyLine;
541
526
  }
542
527
  if (willAddLine) {
543
528
  _this.activeLayer.pens = [_this.hoverLayer.line];
544
529
  _this.dispatch('addLine', _this.hoverLayer.line);
545
530
  } else {
546
- _this.store.data.pens.pop();
531
+ _this.data.pens.pop();
547
532
  _this.activeLayer.clear();
548
533
  }
549
534
  }
@@ -562,7 +547,7 @@ var Topology = (function (_super) {
562
547
  (!_this.hoverLayer.line.from.id || !_this.hoverLayer.line.to.id)) {
563
548
  _this.needCache = true;
564
549
  _this.activeLayer.clear();
565
- _this.store.data.pens.splice(_this.findIndex(_this.hoverLayer.line), 1);
550
+ _this.data.pens.splice(_this.findIndex(_this.hoverLayer.line), 1);
566
551
  }
567
552
  break;
568
553
  }
@@ -575,7 +560,7 @@ var Topology = (function (_super) {
575
560
  _this.needCache = false;
576
561
  };
577
562
  _this.onkeydown = function (key) {
578
- if (_this.store && _this.store.data.locked ||
563
+ if (_this.data.locked ||
579
564
  key.target.tagName === 'INPUT' ||
580
565
  key.target.tagName === 'TEXTAREA') {
581
566
  return;
@@ -586,7 +571,7 @@ var Topology = (function (_super) {
586
571
  switch (key.key) {
587
572
  case 'a':
588
573
  case 'A':
589
- _this.activeLayer.setPens(_this.store.data.pens);
574
+ _this.activeLayer.setPens(_this.data.pens);
590
575
  _this.dispatch('multi', _this.activeLayer.pens);
591
576
  done = true;
592
577
  break;
@@ -690,45 +675,41 @@ var Topology = (function (_super) {
690
675
  return;
691
676
  var obj = JSON.parse(json);
692
677
  event.preventDefault();
693
- if(obj.type && obj.type === 'temp') {
694
- obj.locked = 0;
695
- // 模板
696
- _this.animateLayer.stop();
697
- _this.closeMqtt();
698
- _this.open(obj);
699
- const tempData = {
700
- name: obj.name,
701
- component: obj.component,
702
- image: obj.image,
703
- useType: obj.useType,
704
- data: JSON.parse(json)
705
- };
706
- delete tempData.data['pens'];
707
- _this.dispatch('template', tempData);
708
- }else {
709
- if (obj.name && obj.name == 'arbitraryGraph') {
710
- Store.set('addingArbitraryGraph', true);
711
- _this.addingArbitraryGraph = true;
712
- _this.dispatch('addingArbitraryGraph', true);
713
- return
714
- }
715
- _this.addingArbitraryGraph = false;
716
- Store.set('addingArbitraryGraph', false);
717
- _this.arbitrarygGraphData = {
718
- points: [],
719
- circles: [],
720
- indexCircle: 0, //当前点击的圆圈
721
- oZindex: -1, //是否达到起点
722
- isDragging: false, //是否在抓取
723
- close: false, //闭合
724
- };
678
+ if (obj.name && obj.name == 'arbitraryGraph') {
679
+ Store.set('addingArbitraryGraph', true);
680
+ _this.addingArbitraryGraph = true;
681
+ _this.dispatch('addingArbitraryGraph', true);
682
+ return
683
+ }
684
+ _this.addingArbitraryGraph = false;
685
+ Store.set('addingArbitraryGraph', false);
686
+ _this.arbitrarygGraphData = {
687
+ points: [],
688
+ circles: [],
689
+ indexCircle: 0, //当前点击的圆圈
690
+ oZindex: -1, //是否达到起点
691
+ isDragging: false, //是否在抓取
692
+ close: false, //闭合
693
+ };
694
+ if (obj.name == 'temp') {
695
+ // 温湿度元件
696
+ let activeTempNodes = []
697
+ _this.dropNodes([obj.children[0]], event.offsetX - 23.5, event.offsetY)
698
+ activeTempNodes.push(_this.activeLayer.pens[0])
699
+ _this.dropNodes([obj.children[1]], event.offsetX + 11.5, event.offsetY - 8.5)
700
+ activeTempNodes.push(_this.activeLayer.pens[0])
701
+ _this.dropNodes([obj.children[2]], event.offsetX + 11.5, event.offsetY + 8.5)
702
+ activeTempNodes.push(_this.activeLayer.pens[0])
703
+ _this.activeLayer.pens = activeTempNodes
704
+ _this.combine(activeTempNodes, null, 'temp');
705
+ } else {
725
706
  _this.dropNodes(Array.isArray(obj) ? obj : [obj], event.offsetX, event.offsetY);
726
707
  }
727
708
  } catch (_a) {
728
709
  }
729
710
  };
730
711
  _this.subcribeAnimateMoved = Store.subscribe(this.generateStoreKey('LT:rectChanged'), function (e) {
731
- _this.activeLayer.updateLines(_this.store.data.pens);
712
+ _this.activeLayer.updateLines(_this.data.pens);
732
713
  });
733
714
  _this.subcribeMediaEnd = Store.subscribe(this.generateStoreKey('mediaEnd'), function (node) {
734
715
  if (node.nextPlay) {
@@ -741,7 +722,7 @@ var Topology = (function (_super) {
741
722
  if (window.location.pathname.includes('workspace')) {
742
723
  return
743
724
  }
744
- _this.hidePenByTag(_this.store.data.pens, e);
725
+ _this.hidePenByTag(_this.data.pens, e);
745
726
  const obj = e ? JSON.parse(e) : {}
746
727
  const visibleRange = obj.visibleRange
747
728
  if (visibleRange == '1') {
@@ -752,10 +733,10 @@ var Topology = (function (_super) {
752
733
  _this.divLayer.canvas.onmousedown = this.onmousedown;
753
734
  _this.divLayer.canvas.onmouseup = this.onmouseup;
754
735
  _this.divLayer.canvas.onwheel = function (event) {
755
- if (_this.store.options.disableScale) {
736
+ if (_this.options.disableScale) {
756
737
  return;
757
738
  }
758
- switch (_this.store.options.scaleKey) {
739
+ switch (_this.options.scaleKey) {
759
740
  case KeyType.None:
760
741
  break;
761
742
  case KeyType.Ctrl:
@@ -790,17 +771,17 @@ var Topology = (function (_super) {
790
771
  } else {
791
772
  if (event.layerX && event.layerY) {
792
773
  _this.scale(0.9, {x: event.layerX, y: event.layerY});
793
- _this.canvas.scale(0.9, {x: event.layerX, y: event.layerY});
774
+ _this.canvas.scale(0.9, {x: event.layerX, y: event.layerY});
794
775
  } else {
795
776
  _this.scale(0.9);
796
- _this.canvas.scale(0.9);
777
+ _this.canvas.scale(0.9);
797
778
  }
798
779
  }
799
780
  _this.divLayer.canvas.focus();
800
781
  return false;
801
782
  };
802
783
  _this.cache();
803
- switch (_this.store.options.keydown) {
784
+ switch (_this.options.keydown) {
804
785
  case KeydownType.Document:
805
786
  document.onkeydown = _this.onkeydown;
806
787
  break;
@@ -814,7 +795,6 @@ var Topology = (function (_super) {
814
795
  clearTimeout(timer);
815
796
  }
816
797
  timer = setTimeout(function () {
817
- _this.resize();
818
798
  _this.overflow();
819
799
  _this.render();
820
800
  }, 100);
@@ -823,26 +803,26 @@ var Topology = (function (_super) {
823
803
  return _this;
824
804
  }
825
805
  // Render or redraw
826
- Topology.prototype.render = function (noFocus) {
827
- try{
828
- if (noFocus === void 0) {
829
- noFocus = false;
830
- }
831
- if (noFocus) {
832
- this.activeLayer.pens = [];
833
- this.hoverLayer.node = null;
834
- this.hoverLayer.line = null;
835
- }
836
- if (this.rendering) {
837
- return this;
838
- }
839
- this.rendering = true;
840
- this.offscreen.render();
841
- this.canvas.render();
842
- this.rendering = false;
843
- }catch (e){
844
- //console.log('render-error-------------', e)
845
- }
806
+ Topology.prototype.render = function (noFocus, type) {
807
+ try{
808
+ if (noFocus === void 0) {
809
+ noFocus = false;
810
+ }
811
+ if (noFocus) {
812
+ this.activeLayer.pens = [];
813
+ this.hoverLayer.node = null;
814
+ this.hoverLayer.line = null;
815
+ }
816
+ if (this.rendering) {
817
+ return this;
818
+ }
819
+ this.rendering = true;
820
+ this.offscreen.render();
821
+ this.canvas.render();
822
+ this.rendering = false;
823
+ }catch (e){
824
+ console.log('render-error-------------')
825
+ }
846
826
  };
847
827
  Topology.prototype.resize = function (size) {
848
828
  this.canvasResize(size);
@@ -872,26 +852,58 @@ var Topology = (function (_super) {
872
852
  }
873
853
  if (json.name === 'lineAlone') {
874
854
  _this.addLine({
875
- name: _this.store.data.lineName,
855
+ name: _this.data.lineName,
876
856
  from: new Point(json.rect.x, json.rect.y),
877
- fromArrow: _this.store.data.fromArrowType,
857
+ fromArrow: _this.data.fromArrowType,
878
858
  to: new Point(json.rect.x + json.rect.width, json.rect.y + json.rect.height),
879
- toArrow: _this.store.data.toArrowType,
880
- strokeStyle: _this.store.options.color,
859
+ toArrow: _this.data.toArrowType,
860
+ strokeStyle: _this.options.color,
881
861
  }, true);
882
862
  }
883
863
 
884
864
  if (json.name == 'define') {
865
+
885
866
  // console.log('创建自定义组件 ', json);
867
+
886
868
  console.log('store 中的 自定义 ', Store.get('defineNode'));
887
- _this.dropDefineNode(json, offsetX, offsetY);
888
- } else if(json.name === 'temp') {
889
- // 温湿度元件
890
- _this.dropTempNode(json);
891
- }else {
869
+ if (_this.data.locked) return
870
+ // let defineNode = Store.get('defineNode');
871
+ // let nodesList = Store.get('defineNode').pens;
872
+ let defineNode = JSON.parse(localStorage.getItem("defineNode_"))
873
+ let nodesList = defineNode.pens;
874
+
875
+ let renderNodesList = [];
876
+
877
+ for (let i = 0, len = nodesList.length; i < len; i++) {
878
+
879
+ nodesList[i].rect.x = offsetX - nodesList[i].rect.width / 2;
880
+
881
+ nodesList[i].rect.y = offsetY - nodesList[i].rect.height / 2;
882
+
883
+ let node = new Node(nodesList[i]);
884
+
885
+ node.setTID(s8());
886
+ node.id = s8();
887
+ node.fileId = defineNode.fileId;
888
+
889
+ // console.log('push之前的node', node);
890
+
891
+ _this.data.pens.push(node);
892
+
893
+ renderNodesList.push(node);
894
+ }
895
+ _this.activeLayer.setPens([renderNodesList[0]]);
896
+
897
+ _this.render(false);
898
+
899
+ _this.animate(true);
900
+
901
+ _this.cache();
902
+
903
+ _this.dispatch('addNode', renderNodesList[0]);
904
+
905
+ } else {
892
906
  var node = new Node(json);
893
- if(node.name === 'echarts') node.dash = 4;
894
- if(node.name === 'iframe') node.iframe = 'http://www.yingzeshiji.com.cn/'; // 默认展示盈泽世纪官网
895
907
  node.setTID(_this.id);
896
908
  node.clearChildrenIds();
897
909
  _this.addNode(node, true);
@@ -899,7 +911,7 @@ var Topology = (function (_super) {
899
911
  _this.dispatch('LT:addDiv', node);
900
912
  }
901
913
  if (node.name === 'formTable') {
902
- _this.store.data.dataConstruct[node.id] = {
914
+ _this.data.dataConstruct[node.id] = {
903
915
  id: node.id,
904
916
  name: 'table'
905
917
  }
@@ -908,109 +920,36 @@ var Topology = (function (_super) {
908
920
  });
909
921
  this.divLayer.canvas.focus();
910
922
  };
911
- Topology.prototype.setNodeData = function(node) {
912
- const item = new Node(node);
913
- item.setTID(this.id);
914
- item.clearChildrenIds();
915
- return item;
916
- };
917
- // 添加温湿度元件
918
- Topology.prototype.dropTempNode = function(json) {
919
- const nodeChildren = json.children;
920
- delete json['children'];
921
- const node = this.setNodeData(json);
922
- const combinTempData = [];
923
- let nodeX = node.rect.x;
924
- let nodeY = node.rect.y;
925
- for (let i = 0; i < nodeChildren.length; i++) {
926
- const childNode = this.setNodeData(nodeChildren[i]);
927
- childNode.rect.x = i === 0 ? nodeX : nodeX + childNode.rect.width / 2;
928
- childNode.rect.y = i === 2 ? nodeY + childNode.rect.height + 1 : nodeY;
929
- childNode.rect.center = {
930
- x: childNode.rect.x + childNode.rect.width / 2,
931
- y: childNode.rect.y + childNode.rect.height / 2
932
- }
933
- childNode.rect.ex = childNode.rect.x + childNode.rect.width;
934
- childNode.rect.ey = childNode.rect.y + childNode.rect.height;
935
- combinTempData.push(childNode);
936
- }
937
- this.combine(combinTempData, null, 'temp');
938
- this.render();
939
- this.cache();
940
- };
941
- // 添加自定义元件
942
- Topology.prototype.dropDefineNode = function(josn, offsetX, offsetY) {
943
- var _this = this;
944
- if (_this.store.data.locked) return
945
- // let defineNode = Store.get('defineNode');
946
- // let nodesList = Store.get('defineNode').pens;
947
- let defineNode = JSON.parse(localStorage.getItem("defineNode_"))
948
- let nodesList = defineNode.pens;
949
-
950
- let renderNodesList = [];
951
-
952
- for (let i = 0, len = nodesList.length; i < len; i++) {
953
-
954
- nodesList[i].rect.x = offsetX - nodesList[i].rect.width / 2;
955
-
956
- nodesList[i].rect.y = offsetY - nodesList[i].rect.height / 2;
957
-
958
- let node = new Node(nodesList[i]);
959
-
960
- node.setTID(s8());
961
- node.id = s8();
962
- node.fileId = defineNode.fileId;
963
-
964
- // console.log('push之前的node', node);
965
-
966
- _this.store.data.pens.push(node);
967
-
968
- renderNodesList.push(node);
969
- }
970
- _this.activeLayer.setPens([renderNodesList[0]]);
971
-
972
- _this.render(false);
973
-
974
- _this.animate(true);
975
-
976
- _this.cache();
977
-
978
- _this.dispatch('addNode', renderNodesList[0]);
979
- };
980
- Topology.prototype.addNode = function (node, focus, visit) {
923
+ Topology.prototype.addNode = function (node, focus) {
981
924
  if (focus === void 0) {
982
925
  focus = false;
983
926
  }
984
- if (this.store.data.locked || !drawNodeFns[node.name]) {
927
+ if (this.data.locked || !drawNodeFns[node.name]) {
985
928
  return null;
986
929
  }
987
930
  // if it's not a Node
988
931
  if (!node.init) {
989
932
  node = new Node(node);
990
933
  }
991
- if (!node.strokeStyle && this.store.options.color) {
992
- node.strokeStyle = this.store.options.color;
934
+ if (!node.strokeStyle && this.options.color) {
935
+ node.strokeStyle = this.options.color;
993
936
  }
994
937
  for (var key in node.font) {
995
938
  if (!node.font[key]) {
996
- node.font[key] = this.store.options.font[key];
939
+ node.font[key] = this.options.font[key];
997
940
  }
998
941
  }
999
- if (this.store.data.scale !== 1) {
1000
- node.scale(this.store.data.scale);
942
+ if (this.data.scale !== 1) {
943
+ node.scale(this.data.scale);
1001
944
  }
1002
- node.visibleSwitch = true;
1003
- node.order = this.store.data.pens.length;
1004
- this.store.data.pens.push(node);
1005
- setConnectionTagForConf(node);
945
+ this.data.pens.push(node);
946
+ this.setSwitchTabData(node, this.data.pens.length-1);
1006
947
  if (focus) {
948
+ this.activeLayer.setPens([node]);
1007
949
  this.render();
1008
950
  this.animate(true);
1009
951
  this.cache();
1010
- if(!visit) {
1011
- this.activeLayer.setPens([node]);
1012
- this.dispatch('addNode', node);
1013
- }
952
+ this.dispatch('addNode', node);
1014
953
  }
1015
954
  return node;
1016
955
  };
@@ -1018,14 +957,14 @@ var Topology = (function (_super) {
1018
957
  if (focus === void 0) {
1019
958
  focus = false;
1020
959
  }
1021
- if (this.store.data.locked) {
960
+ if (this.data.locked) {
1022
961
  return null;
1023
962
  }
1024
963
  if (!line.clone) {
1025
964
  line = new Line(line);
1026
965
  line.calcControlPoints(true);
1027
966
  }
1028
- this.store.data.pens.push(line);
967
+ this.data.pens.push(line);
1029
968
  if (focus) {
1030
969
  this.activeLayer.setPens([line]);
1031
970
  this.render();
@@ -1038,10 +977,10 @@ var Topology = (function (_super) {
1038
977
  // open - redraw by the data
1039
978
  Topology.prototype.open = function (topoJSon) {
1040
979
  this.conversionData(topoJSon);
1041
- Store.set(this.generateStoreKey('LT:scale'), this.store.data.scale);
1042
- this.dispatch('scale', this.store.data.scale);
1043
- this.store.parentElem.scrollLeft = 0;
1044
- this.store.parentElem.scrollTop = 0;
980
+ Store.set(this.generateStoreKey('LT:scale'), this.data.scale);
981
+ this.dispatch('scale', this.data.scale);
982
+ this.parentElem.scrollLeft = 0;
983
+ this.parentElem.scrollTop = 0;
1045
984
  this.caches.list = [];
1046
985
  this.divLayer.clear();
1047
986
  this.cache();
@@ -1051,22 +990,22 @@ var Topology = (function (_super) {
1051
990
  this.showGrid();
1052
991
  };
1053
992
  Topology.prototype.overflow = function () {
1054
- try {
1055
- var rect = this.getRect();
1056
- let _a = this.canvas;
1057
- if(!_a.width) return;
1058
- let width = _a.width, height = _a.height;
1059
- if (width < rect.width) {
1060
- width = rect.width;
1061
- }
1062
- if (height < rect.height) {
1063
- height = rect.height;
1064
- }
1065
- this.resize({width: width, height: height});
1066
- return rect;
1067
- }catch (e){
1068
- //console.log('init-error-----------',e)
1069
- }
993
+ try {
994
+ var rect = this.getRect();
995
+ let _a = this.canvas;
996
+ if(!_a.width) return;
997
+ let width = _a.width, height = _a.height;
998
+ if (width < rect.width) {
999
+ width = rect.width;
1000
+ }
1001
+ if (height < rect.height) {
1002
+ height = rect.height;
1003
+ }
1004
+ this.resize({width: width, height: height});
1005
+ return rect;
1006
+ }catch (e){
1007
+ console.log('init-error-----------')
1008
+ }
1070
1009
  };
1071
1010
  Topology.prototype.getMoveIn = function (pt) {
1072
1011
  this.lastHoverNode = this.moveIn.hoverNode;
@@ -1076,13 +1015,13 @@ var Topology = (function (_super) {
1076
1015
  this.moveIn.lineControlPoint = null;
1077
1016
  this.moveIn.hoverLine = null;
1078
1017
  this.hoverLayer.hoverAnchorIndex = -1;
1079
- if (!this.store.data.locked &&
1018
+ if (!this.data.locked &&
1080
1019
  !(this.activeLayer.pens.length === 1 && this.activeLayer.pens[0].type) &&
1081
1020
  !this.activeLayer.locked() &&
1082
1021
  this.activeLayer.rotateCPs[0] &&
1083
1022
  this.activeLayer.rotateCPs[0].hit(pt, 15)) {
1084
1023
  this.moveIn.type = this.moveInType.Rotate;
1085
- var cursor = this.store.options.rotateCursor;
1024
+ var cursor = this.options.rotateCursor;
1086
1025
  this.divLayer.canvas.style.cursor = cursor.includes('/')
1087
1026
  ? "url(\"" + cursor + "\"), auto"
1088
1027
  : cursor;
@@ -1092,9 +1031,9 @@ var Topology = (function (_super) {
1092
1031
  pointInRect(pt, this.activeLayer.sizeCPs)) {
1093
1032
  this.moveIn.type = this.moveInType.Nodes;
1094
1033
  }
1095
- if (!this.store.data.locked &&
1034
+ if (!this.data.locked &&
1096
1035
  !this.activeLayer.locked() &&
1097
- !this.store.options.hideSizeCP) {
1036
+ !this.options.hideSizeCP) {
1098
1037
  if (this.activeLayer.pens.length > 1 ||
1099
1038
  (!this.activeLayer.pens[0].type && !this.activeLayer.pens[0].hideSizeCP)) {
1100
1039
  for (var i = 0; i < this.activeLayer.sizeCPs.length; ++i) {
@@ -1107,8 +1046,8 @@ var Topology = (function (_super) {
1107
1046
  }
1108
1047
  }
1109
1048
  }
1110
- // In active pen.
1111
- if (!this.store.data.locked) {
1049
+ // In active pen.
1050
+ if (!this.data.locked) {
1112
1051
  for (var _i = 0, _a = this.activeLayer.pens; _i < _a.length; _i++) {
1113
1052
  var item = _a[_i];
1114
1053
  if (item instanceof Line && !item.locked) {
@@ -1128,19 +1067,16 @@ var Topology = (function (_super) {
1128
1067
  }
1129
1068
  }
1130
1069
  }
1131
- this.store.data.dataResize = 1;
1132
1070
  this.divLayer.canvas.style.cursor = 'default';
1133
- var len = this.store.data.pens.length;
1071
+ var len = this.data.pens.length;
1134
1072
  for (var i = len - 1; i > -1; --i) {
1135
- if(this.store.data.pens[i].visible || this.store.data.pens[i].visibleSwitch){
1136
- if (this.store.data.pens[i].type === PenType.Node &&
1137
- this.inNode(pt, this.store.data.pens[i])) {
1138
- return;
1139
- } else if (this.store.data.pens[i].type === PenType.Line &&
1140
- this.inLine(pt, this.store.data.pens[i])) {
1141
- // 需要优先判断十分在节点锚点上
1142
- // return;
1143
- }
1073
+ if (this.data.pens[i].type === PenType.Node &&
1074
+ this.inNode(pt, this.data.pens[i])) {
1075
+ return;
1076
+ } else if (this.data.pens[i].type === PenType.Line &&
1077
+ this.inLine(pt, this.data.pens[i])) {
1078
+ // 需要优先判断十分在节点锚点上
1079
+ // return;
1144
1080
  }
1145
1081
  }
1146
1082
  };
@@ -1171,7 +1107,7 @@ var Topology = (function (_super) {
1171
1107
  if (inChild === void 0) {
1172
1108
  inChild = false;
1173
1109
  }
1174
- if (this.store.data.locked === Lock.NoEvent ||
1110
+ if (this.data.locked === Lock.NoEvent ||
1175
1111
  (!node.visible && !window.location.pathname.includes('workspace')) ||
1176
1112
  node.locked === Lock.NoEvent) {
1177
1113
  return null;
@@ -1192,22 +1128,21 @@ var Topology = (function (_super) {
1192
1128
  }
1193
1129
  return child;
1194
1130
  }
1195
- if(!(node instanceof Node)) node = new Node(node);
1196
1131
  if (node.hit(pt)) {
1197
1132
  this.moveIn.hoverNode = node;
1198
1133
  this.moveIn.type = this.moveInType.Nodes;
1199
1134
  // 非绘画页面下禁止不包含点击、双击事件的节点选中鼠标样式
1200
1135
  if (!this.checkNodeOfClickType(node)) {
1201
- if (!this.store.data.locked && !node.locked) {
1136
+ if (!this.data.locked && !node.locked) {
1202
1137
  this.divLayer.canvas.style.cursor = 'move';
1203
1138
  } else {
1204
- this.divLayer.canvas.style.cursor = this.store.options.hoverCursor;
1139
+ this.divLayer.canvas.style.cursor = this.options.hoverCursor;
1205
1140
  }
1206
1141
  }
1207
1142
  // Too small
1208
- if (!this.store.data.locked &&
1143
+ if (!this.data.locked &&
1209
1144
  !node.locked &&
1210
- !(this.store.options.hideAnchor ||
1145
+ !(this.options.hideAnchor ||
1211
1146
  node.hideAnchor ||
1212
1147
  node.rect.width < 20 ||
1213
1148
  node.rect.height < 20)) {
@@ -1230,9 +1165,9 @@ var Topology = (function (_super) {
1230
1165
  }
1231
1166
  return node;
1232
1167
  }
1233
- if (this.store.options.hideAnchor ||
1168
+ if (this.options.hideAnchor ||
1234
1169
  node.hideAnchor ||
1235
- this.store.data.locked ||
1170
+ this.data.locked ||
1236
1171
  node.locked) {
1237
1172
  return null;
1238
1173
  }
@@ -1264,8 +1199,8 @@ var Topology = (function (_super) {
1264
1199
  if (line.from.hit(point, 5)) {
1265
1200
  this.moveIn.type = this.moveInType.LineFrom;
1266
1201
  this.moveIn.hoverLine = line;
1267
- if (this.store.data.locked || line.locked) {
1268
- this.divLayer.canvas.style.cursor = this.store.options.hoverCursor;
1202
+ if (this.data.locked || line.locked) {
1203
+ this.divLayer.canvas.style.cursor = this.options.hoverCursor;
1269
1204
  } else {
1270
1205
  this.divLayer.canvas.style.cursor = 'move';
1271
1206
  }
@@ -1274,8 +1209,8 @@ var Topology = (function (_super) {
1274
1209
  if (line.to.hit(point, 5)) {
1275
1210
  this.moveIn.type = this.moveInType.LineTo;
1276
1211
  this.moveIn.hoverLine = line;
1277
- if (this.store.data.locked || line.locked) {
1278
- this.divLayer.canvas.style.cursor = this.store.options.hoverCursor;
1212
+ if (this.data.locked || line.locked) {
1213
+ this.divLayer.canvas.style.cursor = this.options.hoverCursor;
1279
1214
  } else {
1280
1215
  this.divLayer.canvas.style.cursor = 'move';
1281
1216
  }
@@ -1284,7 +1219,7 @@ var Topology = (function (_super) {
1284
1219
  if (line.pointIn(point)) {
1285
1220
  this.moveIn.type = this.moveInType.LineMove;
1286
1221
  this.moveIn.hoverLine = line;
1287
- this.divLayer.canvas.style.cursor = this.store.options.hoverCursor;
1222
+ this.divLayer.canvas.style.cursor = this.options.hoverCursor;
1288
1223
  if (line.from.id || line.to.id) {
1289
1224
  this.moveIn.type = this.moveInType.Line;
1290
1225
  }
@@ -1294,7 +1229,7 @@ var Topology = (function (_super) {
1294
1229
  };
1295
1230
  Topology.prototype.getLineDock = function (point) {
1296
1231
  this.hoverLayer.dockAnchor = null;
1297
- for (var _i = 0, _a = this.store.data.pens; _i < _a.length; _i++) {
1232
+ for (var _i = 0, _a = this.data.pens; _i < _a.length; _i++) {
1298
1233
  var item = _a[_i];
1299
1234
  if (item instanceof Node) {
1300
1235
  if (item.rect.hit(point, 10)) {
@@ -1361,7 +1296,7 @@ var Topology = (function (_super) {
1361
1296
  rect.ey = rect.y + rect.height;
1362
1297
  }
1363
1298
  this.activeLayer.pens = [];
1364
- for (var _i = 0, _a = this.store.data.pens; _i < _a.length; _i++) {
1299
+ for (var _i = 0, _a = this.data.pens; _i < _a.length; _i++) {
1365
1300
  var item = _a[_i];
1366
1301
  if (item.locked === Lock.NoEvent) {
1367
1302
  continue;
@@ -1408,7 +1343,7 @@ var Topology = (function (_super) {
1408
1343
  x: 0,
1409
1344
  y: 0,
1410
1345
  };
1411
- if (noDock || this.store.options.disableDockLine) {
1346
+ if (noDock || this.options.disableDockLine) {
1412
1347
  return offset;
1413
1348
  }
1414
1349
  var x = 0;
@@ -1417,7 +1352,7 @@ var Topology = (function (_super) {
1417
1352
  var disY = dockOffset;
1418
1353
  for (var _i = 0, _a = this.activeLayer.dockWatchers; _i < _a.length; _i++) {
1419
1354
  var activePt = _a[_i];
1420
- for (var _b = 0, _c = this.store.data.pens; _b < _c.length; _b++) {
1355
+ for (var _b = 0, _c = this.data.pens; _b < _c.length; _b++) {
1421
1356
  var item = _c[_b];
1422
1357
  if (!(item instanceof Node) ||
1423
1358
  this.activeLayer.has(item) ||
@@ -1450,9 +1385,9 @@ var Topology = (function (_super) {
1450
1385
  if (this.caches.index < this.caches.list.length - 1) {
1451
1386
  this.caches.list.splice(this.caches.index + 1, this.caches.list.length - this.caches.index - 1);
1452
1387
  }
1453
- var data = JSON.parse(JSON.stringify(this.store.data));
1388
+ var data = new TopologyData(this.data);
1454
1389
  this.caches.list.push(data);
1455
- if (this.caches.list.length > this.store.options.cacheLen) {
1390
+ if (this.caches.list.length > this.options.cacheLen) {
1456
1391
  this.caches.list.shift();
1457
1392
  }
1458
1393
  this.caches.index = this.caches.list.length - 1;
@@ -1485,31 +1420,31 @@ var Topology = (function (_super) {
1485
1420
  if (noRedo === void 0) {
1486
1421
  noRedo = false;
1487
1422
  }
1488
- if (this.store.data.locked || this.caches.index < 1) {
1423
+ if (this.data.locked || this.caches.index < 1) {
1489
1424
  return;
1490
1425
  }
1491
1426
  this.divLayer.clear();
1492
- var data = JSON.parse(JSON.stringify(this.caches.list[--this.caches.index]));
1493
- this.store.data.pens.splice(0, this.store.data.pens.length);
1494
- this.store.data.pens.push.apply(this.store.data.pens, data.pens);
1427
+ var data = new TopologyData(this.caches.list[--this.caches.index]);
1428
+ this.data.pens.splice(0, this.data.pens.length);
1429
+ this.data.pens.push.apply(this.data.pens, data.pens);
1495
1430
  this.render(true);
1496
1431
  this.divLayer.render();
1497
1432
  if (noRedo) {
1498
1433
  this.caches.list.splice(this.caches.index + 1, this.caches.list.length - this.caches.index - 1);
1499
1434
  }
1500
- this.dispatch('undo', this.store.data);
1435
+ this.dispatch('undo', this.data);
1501
1436
  };
1502
1437
  Topology.prototype.redo = function () {
1503
- if (this.store.data.locked || this.caches.index > this.caches.list.length - 2) {
1438
+ if (this.data.locked || this.caches.index > this.caches.list.length - 2) {
1504
1439
  return;
1505
1440
  }
1506
1441
  this.divLayer.clear();
1507
- var data = JSON.parse(JSON.stringify(this.caches.list[++this.caches.index]));
1508
- this.store.data.pens.splice(0, this.store.data.pens.length);
1509
- this.store.data.pens.push.apply(this.store.data.pens, data.pens);
1442
+ var data = new TopologyData(this.caches.list[++this.caches.index]);
1443
+ this.data.pens.splice(0, this.data.pens.length);
1444
+ this.data.pens.push.apply(this.data.pens, data.pens);
1510
1445
  this.render(true);
1511
1446
  this.divLayer.render();
1512
- this.dispatch('redo', this.store.data);
1447
+ this.dispatch('redo', this.data);
1513
1448
  };
1514
1449
  Topology.prototype.toImage = function (type, quality, callback, padding, thumbnail) {
1515
1450
  if (thumbnail === void 0) {
@@ -1573,14 +1508,14 @@ var Topology = (function (_super) {
1573
1508
  }
1574
1509
  var found = this.findIndex(pen);
1575
1510
  if (found > -1) {
1576
- if (this.store.data.pens[found].type === PenType.Node) {
1577
- this.divLayer.removeDiv(this.store.data.pens[found]);
1511
+ if (this.data.pens[found].type === PenType.Node) {
1512
+ this.divLayer.removeDiv(this.data.pens[found]);
1578
1513
  }
1579
- if (this.store.options.disableEmptyLine) {
1514
+ if (this.options.disableEmptyLine) {
1580
1515
  this.delEmptyLines(pen.id);
1581
1516
  }
1582
- pens.push.apply(pens, this.store.data.pens.splice(found, 1));
1583
- // this.setSwitchTabData(pen, found, 'delete');
1517
+ pens.push.apply(pens, this.data.pens.splice(found, 1));
1518
+ this.setSwitchTabData(pen, found, 'delete');
1584
1519
  --i;
1585
1520
  }
1586
1521
  this.animateLayer.pens.delete(pen.id);
@@ -1593,16 +1528,16 @@ var Topology = (function (_super) {
1593
1528
  this.dispatch('delete', pens);
1594
1529
  };
1595
1530
  Topology.prototype.delEmptyLines = function (deleteedId) {
1596
- for (var i = 0; i < this.store.data.pens.length; i++) {
1597
- if (this.store.data.pens[i].type !== PenType.Line) {
1531
+ for (var i = 0; i < this.data.pens.length; i++) {
1532
+ if (this.data.pens[i].type !== PenType.Line) {
1598
1533
  continue;
1599
1534
  }
1600
- var line = this.store.data.pens[i];
1535
+ var line = this.data.pens[i];
1601
1536
  if (!line.from.id ||
1602
1537
  !line.to.id ||
1603
1538
  line.from.id === deleteedId ||
1604
1539
  line.to.id === deleteedId) {
1605
- this.store.data.pens.splice(i, 1);
1540
+ this.data.pens.splice(i, 1);
1606
1541
  this.animateLayer.pens.delete(line.id);
1607
1542
  --i;
1608
1543
  }
@@ -1611,8 +1546,8 @@ var Topology = (function (_super) {
1611
1546
  Topology.prototype.removeNode = function (node) {
1612
1547
  var i = this.findIndex(node);
1613
1548
  if (i > -1) {
1614
- this.divLayer.removeDiv(this.store.data.pens[i]);
1615
- var nodes = this.store.data.pens.splice(i, 1);
1549
+ this.divLayer.removeDiv(this.data.pens[i]);
1550
+ var nodes = this.data.pens.splice(i, 1);
1616
1551
  this.dispatch('delete', nodes);
1617
1552
  }
1618
1553
  this.render(true);
@@ -1621,28 +1556,28 @@ var Topology = (function (_super) {
1621
1556
  Topology.prototype.removeLine = function (line) {
1622
1557
  var i = this.findIndex(line);
1623
1558
  if (i > -1) {
1624
- var lines = this.store.data.pens.splice(i, 1);
1559
+ var lines = this.data.pens.splice(i, 1);
1625
1560
  this.dispatch('delete', lines);
1626
1561
  }
1627
1562
  this.render(true);
1628
1563
  this.cache();
1629
1564
  };
1630
1565
  Topology.prototype.cut = function () {
1631
- if (this.store.data.locked) {
1566
+ if (this.data.locked) {
1632
1567
  return;
1633
1568
  }
1634
- this.clipboard = {
1569
+ this.clipboard = new TopologyData({
1635
1570
  pens: [],
1636
- };
1571
+ });
1637
1572
  for (var i = 0; i < this.activeLayer.pens.length; i++) {
1638
1573
  var pen = this.activeLayer.pens[i];
1639
1574
  this.clipboard.pens.push(pen.clone());
1640
1575
  var found = this.findIndex(pen);
1641
1576
  if (found > -1) {
1642
1577
  if (pen.type === PenType.Node) {
1643
- this.divLayer.removeDiv(this.store.data.pens[found]);
1578
+ this.divLayer.removeDiv(this.data.pens[found]);
1644
1579
  }
1645
- this.store.data.pens.splice(found, 1);
1580
+ this.data.pens.splice(found, 1);
1646
1581
  --i;
1647
1582
  }
1648
1583
  }
@@ -1659,9 +1594,9 @@ var Topology = (function (_super) {
1659
1594
  return item.animatePlay;
1660
1595
  });
1661
1596
  if(isAnimate) return false;
1662
- this.clipboard = {
1597
+ this.clipboard = new TopologyData({
1663
1598
  pens: [],
1664
- };
1599
+ });
1665
1600
  for (var _i = 0, _a = this.activeLayer.pens; _i < _a.length; _i++) {
1666
1601
  var pen = _a[_i];
1667
1602
  this.clipboard.pens.push(pen.clone());
@@ -1669,7 +1604,7 @@ var Topology = (function (_super) {
1669
1604
  return true;
1670
1605
  };
1671
1606
  Topology.prototype.paste = function () {
1672
- if (!this.clipboard || this.store.data.locked) {
1607
+ if (!this.clipboard || this.data.locked) {
1673
1608
  return;
1674
1609
  }
1675
1610
  this.hoverLayer.node = null;
@@ -1710,10 +1645,9 @@ var Topology = (function (_super) {
1710
1645
  }
1711
1646
  pen.controlPoints = controlPoints;
1712
1647
  }
1713
- pen.order = this.store.data.pens.length;
1714
- this.store.data.pens.push(pen);
1648
+ this.data.pens.push(pen);
1715
1649
  this.activeLayer.add(pen);
1716
- setConnectionTagForConf(pen);
1650
+ this.setSwitchTabData(pen, this.data.pens.length-1);
1717
1651
  }
1718
1652
  this.render();
1719
1653
  this.animate(true);
@@ -1732,13 +1666,13 @@ var Topology = (function (_super) {
1732
1666
  }
1733
1667
  };
1734
1668
  Topology.prototype.bind = function (item, exite, dataType, index) {
1735
- this.clipboard = {
1669
+ this.clipboard = new TopologyData({
1736
1670
  pens: [],
1737
- };
1671
+ });
1738
1672
  for (var _i = 0, _a = this.activeLayer.pens; _i < _a.length; _i++) {
1739
1673
  var pen = _a[_i];
1740
- pen.data = [];
1741
- this.bindInfo(item, pen, dataType, index);
1674
+ pen.data = []
1675
+ this.bindInfo(item, pen, dataType, index)
1742
1676
  this.clipboard.pens.push(pen.clone());
1743
1677
  }
1744
1678
  if (exite == true) {
@@ -1746,23 +1680,48 @@ var Topology = (function (_super) {
1746
1680
  }
1747
1681
  };
1748
1682
  Topology.prototype.bindInfo = async function (item, pen, type, index) {
1749
- const itemNode = item && item.default || item;
1750
- if ([0, '0'].includes(type)) {
1751
- const setTagId = setTagIdData(itemNode);
1752
- pen.data.push(...setTagId);
1683
+ if (type == 0) {
1684
+ pen.data.push({
1685
+ "key": "tagId",
1686
+ "value": item.tagId,
1687
+ "isControlDis": item.isControlDis,
1688
+ "type": item.tagType,
1689
+ "tagVal": item.value,
1690
+ "valExplain": item.valExplain,
1691
+ "tagId": item.tagId
1692
+ }, {
1693
+ "key": "测点名称",
1694
+ "value": item.tagName
1695
+ })
1696
+ let obj = {
1697
+ "key": "threeCategoryId",
1698
+ "value": item.threeCategoryId
1699
+ }
1753
1700
  // 绑定悬浮文字
1754
- pen.title = itemNode.touchpname
1755
- //用于处理场地监控,点击一个资产类别后,隐藏掉这个类别下的所有元件
1756
- const setThreeCategory = setThreeCategoryIdData(pen, itemNode);
1757
- pen.data.push(...setThreeCategory);
1758
- } else if ([1, '1'].includes(type)) {
1759
- const setKpiAddr = setKpiAddrData(itemNode);
1760
- pen.data.push(...setKpiAddr);
1761
- } else if ([2, '2'].includes(type)) {
1762
- const setAssetId = setAssetIdData(itemNode);
1763
- pen.data.push(...setAssetId);
1701
+ pen.title = item.touchpname
1702
+ if (!JSON.stringify(pen.data).includes(JSON.stringify(obj))) {
1703
+ pen.data.push(obj)
1704
+ }
1705
+ } else if (type == 1) {
1706
+ pen.data.push({
1707
+ "key": "kpiAddr",
1708
+ "value": item.kpiId + '_' + item.kpiAddr,
1709
+ "isControlDis": item.isControlDis,
1710
+ "type": item.tagType
1711
+ }, {
1712
+ "key": "指标名称",
1713
+ "value": item.kpiName
1714
+ })
1715
+ } else if (type == 2) {
1716
+ pen.data.push({
1717
+ "key": "assetId",
1718
+ "value": item.id
1719
+ }, {
1720
+ "key": "资产名称",
1721
+ "value": item.name
1722
+ })
1764
1723
  // 绑定悬浮文字
1765
- pen.title = itemNode.bak
1724
+ pen.title = item.bak
1766
1725
  if (pen.subName && pen.subName == 'temp') {
1767
1726
  // 温湿度元件
1768
1727
  // 通讯状态
@@ -1770,19 +1729,23 @@ var Topology = (function (_super) {
1770
1729
  if (index > 0) {
1771
1730
  pen.children[0].text = index + 1 + '#'
1772
1731
  }
1773
- this.bindInfo(itemNode, pen.children[0], type);
1774
- // 温度
1775
- if(item.temperature) {
1776
- pen.children[1].data = [];
1777
- this.bindInfo(item.temperature, pen.children[1], 0);
1778
- }
1779
- // 湿度
1780
- if(item.dampness) {
1781
- pen.children[2].data = []
1782
- this.bindInfo(item.dampness, pen.children[2], 0);
1783
- }
1784
- pen.children.forEach((itemNode) => {
1785
- itemNode.events = [{
1732
+ this.bindInfo(item, pen.children[0], type);
1733
+ // 温度/湿度
1734
+ const _type = 0
1735
+ const ret = await axios.post('/asset/touch_css3000_api/findlist', {assetIds: item.id})
1736
+ ret.data.data.forEach((elem) => {
1737
+ // if(elem.kpiName=='通讯状态'){
1738
+ // }else
1739
+ if (elem.kpiName == '温度') {
1740
+ pen.children[1].data = []
1741
+ this.bindInfo(elem, pen.children[1], _type);
1742
+ } else if (elem.kpiName == '湿度') {
1743
+ pen.children[2].data = []
1744
+ this.bindInfo(elem, pen.children[2], _type);
1745
+ }
1746
+ })
1747
+ pen.children.forEach((item) => {
1748
+ item.events = [{
1786
1749
  "type": 3,
1787
1750
  "action": 2,
1788
1751
  "value": "",
@@ -1790,20 +1753,23 @@ var Topology = (function (_super) {
1790
1753
  }]
1791
1754
  })
1792
1755
  }
1793
- } else if ([3, '3'].includes(type)) {
1794
- const setAreaId = setAreaIdData(itemNode);
1795
- pen.data.push(...setAreaId);
1796
- }else if ([4, '4'].includes(type)) {
1797
- const setVarId = setVarValueData(itemNode);
1798
- pen.data.push(...setVarId);
1799
- }
1800
- // if([0, 2, '0', '2'].includes(type)) {
1801
- // //用于处理场地监控,点击一个资产类别后,隐藏掉这个类别下的所有元件
1802
- // const setThreeCategory = setThreeCategoryIdData(pen, itemNode);
1803
- //
1804
- // pen.data.push(...setThreeCategory);
1805
- // }
1806
- return pen;
1756
+ } else if (type == 3) {
1757
+ pen.data.push({
1758
+ "key": "areaId",
1759
+ "value": item.id
1760
+ }, {
1761
+ "key": "区域名称",
1762
+ "value": item.name
1763
+ })
1764
+ }
1765
+ // let str = JSON.stringify(pen.events)
1766
+ // pen.events.forEach((_item) => {
1767
+ // if(_item.action==0 && _item.dcimDetailPage && _item.dcimDetailPage != '' && item.devId){
1768
+ // str = str.replace(new RegExp(_item.dcimAssetValue,'g'), item.devId)
1769
+ // }
1770
+ // });
1771
+ // pen.events = JSON.parse(str)
1772
+ return pen
1807
1773
  };
1808
1774
  Topology.prototype.newId = function (node, idMaps) {
1809
1775
  var old = node.id;
@@ -1823,12 +1789,10 @@ var Topology = (function (_super) {
1823
1789
  if (!pens) {
1824
1790
  pens = this.activeLayer.pens;
1825
1791
  }
1826
- let isAnimate = false;
1827
1792
  for (var _i = 0, pens_1 = pens; _i < pens_1.length; _i++) {
1828
1793
  var pen = pens_1[_i];
1829
1794
  if (pen instanceof Node) {
1830
1795
  let isRotateBug = false
1831
- isAnimate = pen.animateFrames && pen.animateFrames.length
1832
1796
  if (pen.rotate === 0) {
1833
1797
  pen.rotate = 360
1834
1798
  isRotateBug = true
@@ -1847,20 +1811,19 @@ var Topology = (function (_super) {
1847
1811
  this.activeLayer.calcControlPoints();
1848
1812
  this.activeLayer.saveNodeRects();
1849
1813
  this.render();
1850
- if(isAnimate) this.animate(true);
1851
1814
  // tslint:disable-next-line: no-unused-expression
1852
1815
  cache && this.cache();
1853
1816
  };
1854
1817
  Topology.prototype.lock = function (lock) {
1855
- this.store.data.locked = lock;
1856
- for (var _i = 0, _a = this.store.data.pens; _i < _a.length; _i++) {
1818
+ this.data.locked = lock;
1819
+ for (var _i = 0, _a = this.data.pens; _i < _a.length; _i++) {
1857
1820
  var item = _a[_i];
1858
1821
  item.addToDiv && item.addToDiv();
1859
1822
  }
1860
- this.dispatch('locked', this.store.data.locked);
1823
+ this.dispatch('locked', this.data.locked);
1861
1824
  };
1862
1825
  Topology.prototype.lockPens = function (pens, lock) {
1863
- for (var _i = 0, _a = this.store.data.pens; _i < _a.length; _i++) {
1826
+ for (var _i = 0, _a = this.data.pens; _i < _a.length; _i++) {
1864
1827
  var item = _a[_i];
1865
1828
  for (var _b = 0, pens_2 = pens; _b < pens_2.length; _b++) {
1866
1829
  var pen = pens_2[_b];
@@ -1878,33 +1841,33 @@ var Topology = (function (_super) {
1878
1841
  };
1879
1842
  Topology.prototype.up = function (pen) {
1880
1843
  var i = this.findIndex(pen);
1881
- if (i > -1 && i !== this.store.data.pens.length - 1) {
1882
- this.store.data.pens.splice(i + 2, 0, this.store.data.pens[i]);
1883
- this.store.data.pens.splice(i, 1);
1844
+ if (i > -1 && i !== this.data.pens.length - 1) {
1845
+ this.data.pens.splice(i + 2, 0, this.data.pens[i]);
1846
+ this.data.pens.splice(i, 1);
1884
1847
  }
1885
1848
  };
1886
1849
  Topology.prototype.top = function (pen) {
1887
1850
  var i = this.findIndex(pen);
1888
1851
  if (i > -1) {
1889
- this.store.data.pens.push(this.store.data.pens[i]);
1890
- this.store.data.pens.splice(i, 1);
1852
+ this.data.pens.push(this.data.pens[i]);
1853
+ this.data.pens.splice(i, 1);
1891
1854
  }
1892
1855
  };
1893
1856
  Topology.prototype.down = function (pen) {
1894
1857
  var i = this.findIndex(pen);
1895
1858
  if (i > -1 && i !== 0) {
1896
- this.store.data.pens.splice(i - 1, 0, this.store.data.pens[i]);
1897
- this.store.data.pens.splice(i + 1, 1);
1859
+ this.data.pens.splice(i - 1, 0, this.data.pens[i]);
1860
+ this.data.pens.splice(i + 1, 1);
1898
1861
  }
1899
1862
  };
1900
1863
  Topology.prototype.bottom = function (pen) {
1901
1864
  var i = this.findIndex(pen);
1902
1865
  if (i > -1) {
1903
- this.store.data.pens.unshift(this.store.data.pens[i]);
1904
- this.store.data.pens.splice(i + 1, 1);
1866
+ this.data.pens.unshift(this.data.pens[i]);
1867
+ this.data.pens.splice(i + 1, 1);
1905
1868
  }
1906
1869
  };
1907
- Topology.prototype.combine = function (pens, stand, temp, rect) {
1870
+ Topology.prototype.combine = function (pens, stand, temp) {
1908
1871
  if (stand === void 0) {
1909
1872
  stand = false;
1910
1873
  }
@@ -1917,7 +1880,7 @@ var Topology = (function (_super) {
1917
1880
  var item = pens_3[_i];
1918
1881
  var i = this.findIndex(item);
1919
1882
  if (i > -1) {
1920
- this.store.data.pens.splice(i, 1);
1883
+ this.data.pens.splice(i, 1);
1921
1884
  }
1922
1885
  }
1923
1886
  var node = new Node({
@@ -1929,8 +1892,6 @@ var Topology = (function (_super) {
1929
1892
  paddingTop: 0,
1930
1893
  paddingBottom: 0,
1931
1894
  strokeStyle: 'transparent',
1932
- visible: true,
1933
- visibleSwitch: true,
1934
1895
  children: [],
1935
1896
  });
1936
1897
  if (temp) {
@@ -1941,14 +1902,10 @@ var Topology = (function (_super) {
1941
1902
  item.stand = stand;
1942
1903
  item.parentId = node.id;
1943
1904
  item.animatePlay = false;
1944
- item.visible = true;
1945
- item.visibleSwitch = true;
1946
1905
  item.calcRectInParent(node);
1947
- this.deleteSelectTabOptionNode(item);
1948
1906
  node.children.push(item);
1949
1907
  }
1950
- node.order = this.store.data.pens.length;
1951
- this.store.data.pens.push(node);
1908
+ this.data.pens.push(node);
1952
1909
  this.activeLayer.setPens([node]);
1953
1910
  this.dispatch('node', node);
1954
1911
  this.cache();
@@ -1961,57 +1918,27 @@ var Topology = (function (_super) {
1961
1918
  return;
1962
1919
  }
1963
1920
  const nodeChildren = JSON.parse(JSON.stringify(node));
1964
- var i = this.findIndex(nodeChildren);
1965
- if (i > -1 && nodeChildren.name === 'combine') {
1966
- this.store.data.pens.splice(i, 1);
1967
- } else {
1968
- nodeChildren.children = null;
1969
- }
1970
1921
  for (var _i = 0, _a = nodeChildren.children; _i < _a.length; _i++) {
1971
1922
  var item = new Node(_a[_i]);
1972
1923
  item.parentId = undefined;
1973
1924
  item.rectInParent = undefined;
1974
1925
  item.locked = Lock.None;
1975
- item.order = this.store.data.pens.length;
1976
- this.addSelectTabOptionNode(item);
1977
- this.store.data.pens.push(item);
1926
+ this.data.pens.push(item);
1927
+ }
1928
+ var i = this.findIndex(nodeChildren);
1929
+ if (i > -1 && nodeChildren.name === 'combine') {
1930
+ this.data.pens.splice(i, 1);
1931
+ } else {
1932
+ nodeChildren.children = null;
1978
1933
  }
1979
- this.deleteSelectTabOptionNode(nodeChildren);
1980
1934
  this.cache();
1981
1935
  this.activeLayer.clear();
1982
1936
  this.hoverLayer.clear();
1983
1937
  };
1984
- Topology.prototype.deleteSelectTabOptionNode = function (node) {
1985
- const tagNode = node.tags.find((t) => {return t.includes('selectOption')});
1986
- if(tagNode){
1987
- // 删除下拉节点关联的这个元件
1988
- const tagArr = tagNode.split('-');
1989
- const parentId = tagArr[1] && tagArr[1].trim();
1990
- if(parentId && this.store.selectTabDataPool[parentId].has(node.id)) this.store.selectTabDataPool[parentId].delete(node.id);
1991
- }
1992
- },
1993
- Topology.prototype.addSelectTabOptionNode = function (node) {
1994
- const tagNode = node.tags.find((t) => {return t.includes('selectOption')});
1995
- if(tagNode){
1996
- // 添加下拉节点关联的这个元件
1997
- const tagArr = tagNode.split('-');
1998
- const parentId = tagArr[1] && tagArr[1].trim();
1999
- if(!parentId) return;
2000
- const params = {
2001
- TID: node.TID,
2002
- id: node.id,
2003
- name: node.name,
2004
- order: node.order,
2005
- visible: node.visible,
2006
- tag: tagNode
2007
- }
2008
- this.store.selectTabDataPool[parentId].set(node.id, params);
2009
- }
2010
- },
2011
1938
  Topology.prototype.find = function (idOrTag, pens) {
2012
1939
  var _this = this;
2013
1940
  if (!pens) {
2014
- pens = this.store.data.pens;
1941
+ pens = this.data.pens;
2015
1942
  }
2016
1943
  var result = [];
2017
1944
  pens.forEach(function (item) {
@@ -2028,28 +1955,28 @@ var Topology = (function (_super) {
2028
1955
  return result;
2029
1956
  };
2030
1957
  Topology.prototype.findIndex = function (pen) {
2031
- for (var i = 0; i < this.store.data.pens.length; ++i) {
2032
- if (pen.id === this.store.data.pens[i].id) {
1958
+ for (var i = 0; i < this.data.pens.length; ++i) {
1959
+ if (pen.id === this.data.pens[i].id) {
2033
1960
  return i;
2034
1961
  }
2035
1962
  }
2036
1963
  return -1;
2037
1964
  };
2038
1965
  Topology.prototype.anchor = function (anchor) {
2039
- this.store.options.hideAnchor = anchor
1966
+ this.options.hideAnchor = anchor
2040
1967
  this.dispatch('hideAnchor', anchor);
2041
1968
  };
2042
1969
  // scale for scaled canvas:
2043
1970
  // > 1, expand
2044
1971
  // < 1, reduce
2045
1972
  Topology.prototype.scale = function (scale, center, w, h) {
2046
- if (this.store.data.scale * scale < this.store.options.minScale ||
2047
- this.store.data.scale * scale > this.store.options.maxScale) {
1973
+ if (this.data.scale * scale < this.options.minScale ||
1974
+ this.data.scale * scale > this.options.maxScale) {
2048
1975
  return;
2049
1976
  }
2050
- this.store.data.scale *= scale;
1977
+ this.data.scale *= scale;
2051
1978
  !center && (center = this.getRect().center);
2052
- for (var _i = 0, _a = this.store.data.pens; _i < _a.length; _i++) {
1979
+ for (var _i = 0, _a = this.data.pens; _i < _a.length; _i++) {
2053
1980
  var item = _a[_i];
2054
1981
  item.scale(scale, center, w, h);
2055
1982
  }
@@ -2058,18 +1985,18 @@ var Topology = (function (_super) {
2058
1985
  pen.scale(scale, center);
2059
1986
  }
2060
1987
  });
2061
- Store.set(this.generateStoreKey('LT:scale'), this.store.data.scale);
1988
+ Store.set(this.generateStoreKey('LT:scale'), this.data.scale);
2062
1989
  this.render();
2063
1990
  this.cache();
2064
- this.dispatch('scale', this.store.data.scale);
1991
+ this.dispatch('scale', this.data.scale);
2065
1992
  };
2066
1993
  // scale for origin canvas:
2067
1994
  Topology.prototype.scaleTo = function (scale) {
2068
- this.scale(scale / this.store.data.scale);
2069
- this.store.data.scale = scale;
1995
+ this.scale(scale / this.data.scale);
1996
+ this.data.scale = scale;
2070
1997
  };
2071
1998
  Topology.prototype.round = function () {
2072
- for (var _i = 0, _a = this.store.data.pens; _i < _a.length; _i++) {
1999
+ for (var _i = 0, _a = this.data.pens; _i < _a.length; _i++) {
2073
2000
  var item = _a[_i];
2074
2001
  if (item instanceof Node) {
2075
2002
  item.round();
@@ -2080,7 +2007,7 @@ var Topology = (function (_super) {
2080
2007
  if (!this.hasView())
2081
2008
  return;
2082
2009
  // 1. 重置画布尺寸为容器尺寸
2083
- var parentElem = this.store.parentElem;
2010
+ var parentElem = this.canvas.parentElem;
2084
2011
  var width = parentElem.offsetWidth, height = parentElem.offsetHeight;
2085
2012
  this.resize({
2086
2013
  width: width,
@@ -2089,7 +2016,7 @@ var Topology = (function (_super) {
2089
2016
  // 2. 图形居中
2090
2017
  this.centerView(viewPadding);
2091
2018
  // 3. 获取设置的留白值
2092
- var padding = formatPadding(viewPadding || this.store.options.viewPadding);
2019
+ var padding = formatPadding(viewPadding || this.options.viewPadding);
2093
2020
  // 4. 获取图形尺寸
2094
2021
  var rect = this.getRect();
2095
2022
  // 6. 计算缩放比
@@ -2102,7 +2029,7 @@ var Topology = (function (_super) {
2102
2029
  this.scale(ratio);
2103
2030
  };
2104
2031
  Topology.prototype.showTipText = function (data, pos) {
2105
- if (this.store.data.locked && data.title) {
2032
+ if (this.data.locked && data.title) {
2106
2033
  this.divLayer.canvas.title = data.title;
2107
2034
  this.tip = data.id;
2108
2035
  }
@@ -2113,15 +2040,15 @@ var Topology = (function (_super) {
2113
2040
  return;
2114
2041
  }
2115
2042
  this.scrolling = true;
2116
- this.store.parentElem.scrollLeft += x;
2117
- this.store.parentElem.scrollTop += y;
2043
+ this.parentElem.scrollLeft += x;
2044
+ this.parentElem.scrollTop += y;
2118
2045
  setTimeout(function () {
2119
2046
  _this.scrolling = false;
2120
2047
  }, 700);
2121
2048
  };
2122
2049
  Topology.prototype.toComponent = function (pens) {
2123
2050
  if (!pens) {
2124
- pens = this.store.data.pens;
2051
+ pens = this.data.pens;
2125
2052
  }
2126
2053
  var rect = this.getRect(pens);
2127
2054
  var node = new Node({
@@ -2162,7 +2089,7 @@ var Topology = (function (_super) {
2162
2089
  attr = 'text';
2163
2090
  }
2164
2091
  var pen;
2165
- this.store.data.pens.forEach(function (item) {
2092
+ this.data.pens.forEach(function (item) {
2166
2093
  if (item.id === idOrTag || item.tags.indexOf(idOrTag) > -1) {
2167
2094
  pen = item;
2168
2095
  }
@@ -2174,7 +2101,7 @@ var Topology = (function (_super) {
2174
2101
  attr = 'text';
2175
2102
  }
2176
2103
  var pen;
2177
- this.store.data.pens.forEach(function (item) {
2104
+ this.data.pens.forEach(function (item) {
2178
2105
  if (item.id === idOrTag || item.tags.indexOf(idOrTag) > -1) {
2179
2106
  pen = item;
2180
2107
  }
@@ -2187,12 +2114,11 @@ var Topology = (function (_super) {
2187
2114
  this.gridElem.style.left = '0';
2188
2115
  this.gridElem.style.top = '0';
2189
2116
  this.gridElem.innerHTML = "<svg class=\"svg-grid\" width=\"100%\" height=\"100%\" style=\"position:absolute;left:0;right:0;top:0;bottom:0\"\n xmlns=\"http://www.w3.org/2000/svg\">\n <defs>\n <pattern id=\"grid\" width=\"10\" height=\"10\" patternUnits=\"userSpaceOnUse\">\n <path d=\"M 10 0 L 0 0 0 10\" fill=\"none\" stroke=\"#f3f3f3\" stroke-width=\"1\" />\n </pattern>\n </defs>\n <rect width=\"100%\" height=\"100%\" fill=\"url(#grid)\" />\n </svg>";
2190
- this.store.parentElem.appendChild(this.gridElem);
2117
+ this.parentElem.appendChild(this.gridElem);
2191
2118
  };
2192
2119
  Topology.prototype.showGrid = function (show) {
2193
- if(!this.store || !this.store.data) return;
2194
2120
  if (show === undefined) {
2195
- show = this.store.data.grid;
2121
+ show = this.data.grid;
2196
2122
  }
2197
2123
  this.gridElem.style.width = this.canvas.width + 'px';
2198
2124
  this.gridElem.style.height = this.canvas.height + 'px';
@@ -2283,7 +2209,7 @@ var Topology = (function (_super) {
2283
2209
  canvas.style.height = 500 + 'px';
2284
2210
  canvas.style.zIndex = 1;
2285
2211
  canvas.setAttribute('id', 'arbitraryCanvas');
2286
- this.store.parentElem.appendChild(canvas)
2212
+ this.parentElem.appendChild(canvas)
2287
2213
  };
2288
2214
  Topology.prototype.createArbitraryGraph = function () {
2289
2215
 
@@ -2340,31 +2266,6 @@ var Topology = (function (_super) {
2340
2266
 
2341
2267
  return true
2342
2268
  };
2343
- Topology.prototype.formOverflowOpen = function (data) {
2344
- this.formOverflowConversionData(data);
2345
- this.overflowView();
2346
- this.render(true);
2347
- }
2348
- Topology.prototype.overflowView = function (data) {
2349
- try {
2350
- var rect = this.getRect();
2351
- let _a = this.canvas;
2352
- if(!_a.width) return;
2353
- let width = _a.width, height = _a.height;
2354
- let rectWidth = rect.width? (rect.ex + 4) : rect.width
2355
- let rectHeight= rect.height? (rect.ey + 4) : rect.height
2356
- if (width < rectWidth) {
2357
- width = rectWidth;
2358
- }
2359
- if (height < rectHeight) {
2360
- height = rectHeight;
2361
- }
2362
- this.resize({width: width, height: height});
2363
- return rect;
2364
- }catch (e){
2365
- console.log('-error--------overflowView---',e)
2366
- }
2367
- }
2368
2269
  return Topology;
2369
2270
  }(Common));
2370
2271