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
@@ -20,9 +20,8 @@ import { defaultAnchors } from '../middles/default.anchor';
20
20
  import { defaultIconRect, defaultTextRect } from '../middles/default.rect';
21
21
  import { text, tableText, defaultText, iconfont } from '../middles/nodes/text';
22
22
  import { Store } from 'le5le-store';
23
- import { abs, s8, animateType } from '../utils';
24
- export const images = {};
25
- export const defaultImages = {};
23
+ import { abs, s8, animateType, createChildrenDivByElementId } from '../utils';
24
+ export var images = {};
26
25
  var Node = /** @class */ (function (_super) {
27
26
  __extends(Node, _super);
28
27
  function Node(json, noChild) {
@@ -36,11 +35,8 @@ var Node = /** @class */ (function (_super) {
36
35
  _this.animateDuration = 0;
37
36
  _this.animateFrames = [];
38
37
  _this.type = PenType.Node;
39
- _this.TID = json.TID;
40
- _this.selectDropdown = json.selectDropdown || false;
41
38
  _this.is3D = json.is3D;
42
39
  _this.z = json.z;
43
- _this.order = json.order;
44
40
  _this.zRotate = json.zRotate || 0;
45
41
  _this.borderRadius = +json.borderRadius || 0;
46
42
  _this.icon = json.icon;
@@ -48,13 +44,6 @@ var Node = /** @class */ (function (_super) {
48
44
  _this.iconSize = +json.iconSize;
49
45
  _this.iconColor = json.iconColor;
50
46
  _this.image = json.image;
51
- _this.tabData = json.tabData || {
52
- state: false,
53
- name: '℃',
54
- min: 0,
55
- max: 60,
56
- interval: 20
57
- };
58
47
  _this.floorImageIndex = json.floorImageIndex || false;
59
48
  _this.formData = json.formData || null;
60
49
  _this.formStyle = json.formStyle || null;
@@ -90,8 +79,8 @@ var Node = /** @class */ (function (_super) {
90
79
  _this.leakageEnd = json.leakageEnd || 0;
91
80
  _this.leakageFillStyle = json.leakageFillStyle || '#ff0000';
92
81
  _this.bindStaticId = json.bindStaticId || '';
93
- //_this.buttonCheckSlide = json.buttonCheckSlide || '';
94
- _this.visitStrokeStyle = json.visitStrokeStyle || '';
82
+ _this.buttonCheckSlide = json.buttonCheckSlide || '';
83
+ _this.activeImgeIndex = json.activeImgeIndex || false;
95
84
  _this.thBottomStrokeStyle = json.thBottomStrokeStyle || '#fff';
96
85
  _this.thBottomLineWidth = json.thBottomLineWidth || 1;
97
86
  // 兼容老数据
@@ -138,7 +127,6 @@ var Node = /** @class */ (function (_super) {
138
127
  : '';
139
128
  _this.animateAlone = json.animateAlone;
140
129
  _this.iframe = json.iframe;
141
- _this.iframePageAuto = json.iframePageAuto || false;
142
130
  _this.elementId = json.elementId;
143
131
  _this.audio = json.audio;
144
132
  _this.video = json.video;
@@ -244,11 +232,18 @@ var Node = /** @class */ (function (_super) {
244
232
  data: tableData
245
233
  })
246
234
  };
247
- Node.prototype.addToDiv = function () {
248
- if (this.iframe ||
235
+ Node.prototype.addToDiv = function (type) {
236
+ if (this.audio ||
237
+ this.video ||
238
+ this.iframe ||
249
239
  this.elementId ||
250
240
  this.hasGif()) {
241
+ if(type) {
242
+ // 复合Echarts初始化
243
+ createChildrenDivByElementId(this);
244
+ }else {
251
245
  Store.set(this.generateStoreKey('LT:addDiv'), this);
246
+ }
252
247
  }
253
248
  };
254
249
  Node.prototype.hasGif = function () {
@@ -278,7 +273,6 @@ var Node = /** @class */ (function (_super) {
278
273
  this.children = [];
279
274
  for (var _i = 0, children_1 = children; _i < children_1.length; _i++) {
280
275
  var item = children_1[_i];
281
- item.visible = this.visible;
282
276
  var child = void 0;
283
277
  switch (item.type) {
284
278
  case PenType.Line:
@@ -411,10 +405,9 @@ var Node = /** @class */ (function (_super) {
411
405
  //this.drawImg(ctx);
412
406
  return;
413
407
  }
414
- const defaultImageNode = defaultImages[this.id];
415
408
  var img = new Image();
416
409
  img.crossOrigin = 'anonymous';
417
- img.src = defaultImageNode && defaultImageNode.status === 404 ? '' : this.image;
410
+ img.src = this.image;
418
411
  img.onload = function (e) {
419
412
  _this.lastImage = _this.image;
420
413
  _this.imgNaturalWidth = img.naturalWidth;
@@ -424,20 +417,12 @@ var Node = /** @class */ (function (_super) {
424
417
  img: img,
425
418
  cnt: 1,
426
419
  };
427
- if(defaultImageNode) delete defaultImages[_this.id];
428
420
  Store.set(_this.generateStoreKey('LT:imageLoaded'), true);
429
421
  if (!_this.gif && gif) {
430
422
  _this.gif = true;
431
423
  Store.set(_this.generateStoreKey('LT:addDiv'), _this);
432
424
  }
433
425
  };
434
- img.onerror = function(e){
435
- // 图片加载失败时预留默认图为空
436
- defaultImages[_this.id] = {
437
- img: '',
438
- status: 404
439
- };
440
- };
441
426
  };
442
427
  Node.prototype.initDrawImg = function (ctx){
443
428
  var _this = this;
@@ -624,8 +609,8 @@ var Node = /** @class */ (function (_super) {
624
609
  this.dash = item.state.dash;
625
610
  this.strokeStyle = item.state.strokeStyle;
626
611
  this.fillStyle = item.state.fillStyle;
627
- //this.text = item.state.text;
628
- //this.font = item.state.font;
612
+ this.text = item.state.text;
613
+ this.font = item.state.font;
629
614
  this.lineWidth = item.state.lineWidth;
630
615
  this.rotate = item.state.rotate;
631
616
  this.globalAlpha = item.state.globalAlpha;
@@ -651,8 +636,8 @@ var Node = /** @class */ (function (_super) {
651
636
  this.dash = item.state.dash;
652
637
  this.strokeStyle = item.state.strokeStyle;
653
638
  this.fillStyle = item.state.fillStyle;
654
- //this.text = item.state.text;
655
- //this.font = item.state.font;
639
+ this.text = item.state.text;
640
+ this.font = item.state.font;
656
641
  var rate = (timeline - item.start) / item.duration;
657
642
  if (item.linear) {
658
643
  // 线条左右流动动画
@@ -749,27 +734,26 @@ var Node = /** @class */ (function (_super) {
749
734
  this['oldRect'] = this.rect.clone();
750
735
  if(this.rect.circles) {
751
736
  for(let c=0, circles= this.rect.circles; c<circles.length; c++) {
752
- circles[c].x = center.x - (center.x - circles[c].x) * w;
753
- circles[c].y = center.y - (center.y - circles[c].y) * h;
737
+ circles[c].x = (center.x - (center.x - circles[c].x)) * w;
738
+ circles[c].y = (center.y - (center.y - circles[c].y)) * h + 15;
754
739
  }
740
+ }else {
741
+ this.rect.x = center.x - (center.x - this.rect.x) * w;
742
+ if(this.rotate % 180) {
743
+ this.rect.x = this.rect.x + (this.rect.width * w - this.rect.width * h) / 2;
744
+ }
745
+ this.rect.y = center.y - (center.y - this.rect.y) * h;
755
746
  }
756
- this.rect.x = center.x - (center.x - this.rect.x) * w;
757
- if(this.rotate % 180) {
758
- this.rect.x = this.rect.x + (this.rect.width * w - this.rect.width * h) / 2;
759
- }
760
- this.rect.y = center.y - (center.y - this.rect.y) * h;
747
+ this.z *= scale;
761
748
  this.rect.width *= this.rotate % 180 ? h : w;
762
749
  this.rect.height *= h;
763
750
  this.rect.ex = this.rect.x + this.rect.width;
764
751
  this.rect.ey = this.rect.y + this.rect.height;
765
- this.z *= scale;
766
- if(!(center.type && center.type === 'bottLogo')) {
767
- if (this.imageWidth) {
768
- this.imageWidth *= w;
769
- }
770
- if (this.imageHeight) {
771
- this.imageHeight *= h;
772
- }
752
+ if (this.imageWidth) {
753
+ this.imageWidth *= w;
754
+ }
755
+ if (this.imageHeight) {
756
+ this.imageHeight *= h;
773
757
  }
774
758
  this.lastImage = null;
775
759
  this.font.fontSize *= scale;
@@ -867,12 +851,6 @@ var Node = /** @class */ (function (_super) {
867
851
  }
868
852
  };
869
853
  Node.prototype.translate = function (x, y) {
870
- if(this.rect.circles) {
871
- for(let c=0, circles= this.rect.circles; c<circles.length; c++) {
872
- circles[c].x += x;
873
- circles[c].y += y;
874
- }
875
- }
876
854
  this.rect.x += x;
877
855
  this.rect.y += y;
878
856
  this.rect.ex = this.rect.x + this.rect.width;
@@ -3,6 +3,7 @@ import { s8 } from '../utils/uuid';
3
3
  import { Rect } from './rect';
4
4
  import { pointInRect } from '../utils/canvas';
5
5
  import { EventType, EventAction } from './event';
6
+ import { setConfItemNode } from '../healps/changeData';
6
7
  export var PenType;
7
8
  (function (PenType) {
8
9
  PenType[PenType["Node"] = 0] = "Node";
@@ -18,12 +19,14 @@ var Pen = /** @class */ (function () {
18
19
  this.globalAlpha = 1;
19
20
  this.dash = 0;
20
21
  this.strokeStyle = '';
21
- this.visitStrokeStyle = '';
22
22
  this.fillStyle = '';
23
+ this.defaultFillStyle = '';
24
+ this.defaultFontColor = '#fff';
25
+ this.defaultStrokeStyle = '';
23
26
  this.font = {
24
27
  color: '',
25
28
  fontFamily: '"Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial',
26
- fontSize: json.name === 'select' ? 14 : 12,
29
+ fontSize: 12,
27
30
  lineHeight: 1.5,
28
31
  fontStyle: 'normal',
29
32
  fontWeight: 'normal',
@@ -44,9 +47,6 @@ var Pen = /** @class */ (function () {
44
47
  this.events = [];
45
48
  this.eventFns = ['link', 'doAnimate', 'doFn', 'doWindowFn'];
46
49
  this.floorImageIndex = false;
47
- this.defaultFillStyle = '';
48
- this.defaultFontColor = '';
49
- this.defaultStrokeStyle = '';
50
50
  if (json) {
51
51
  this.id = json.id || s8();
52
52
  this.name = json.name || '';
@@ -71,10 +71,11 @@ var Pen = /** @class */ (function () {
71
71
  if (json.lineWidth || json.lineWidth === 0) {
72
72
  this.lineWidth = json.lineWidth;
73
73
  }
74
- this.activeImgeIndex = json.activeImgeIndex || false;
75
- this.visitStrokeStyle = json.visitStrokeStyle || '';
76
74
  this.strokeStyle = json.strokeStyle || '';
77
75
  this.fillStyle = json.fillStyle || '';
76
+ this.defaultFillStyle = json.defaultFillStyle || '';
77
+ this.defaultFontColor = json.defaultFontColor || '#fff';
78
+ this.defaultStrokeStyle = json.defaultStrokeStyle || '';
78
79
  this.lineCap = json.lineCap;
79
80
  this.globalAlpha = (json.globalAlpha || json.globalAlpha === 0) ? json.globalAlpha : 1
80
81
  this.rotate = json.rotate || 0;
@@ -107,10 +108,6 @@ var Pen = /** @class */ (function () {
107
108
  this.tipId = json.tipId;
108
109
  this.title = json.title;
109
110
  this.visible = json.visible !== false;
110
- this.visibleSwitch = !!json.visibleSwitch; // 元件显示隐藏的开关量
111
- this.defaultFillStyle = json.defaultFillStyle || '';
112
- this.defaultFontColor = json.defaultFontColor || '';
113
- this.defaultStrokeStyle = json.defaultStrokeStyle || '';
114
111
  if (json.rectInParent) {
115
112
  this.rectInParent = json.rectInParent;
116
113
  }
@@ -131,7 +128,7 @@ var Pen = /** @class */ (function () {
131
128
  }
132
129
  }
133
130
  Pen.prototype.render = function (ctx) {
134
- if (!this.visible && !this.visibleSwitch){
131
+ if (!this.visible && !window.location.pathname.includes('workspace')){
135
132
  return;
136
133
  }
137
134
  if (this.from && !this.to) {
@@ -150,13 +147,7 @@ var Pen = /** @class */ (function () {
150
147
  if (this.lineWidth > 1) {
151
148
  ctx.lineWidth = this.lineWidth;
152
149
  }
153
- if(this.dash === 4) {
154
- ctx.strokeStyle = 'transparent';
155
- }else {
156
- const staticStrokeStyle = this.strokeStyle || '#222';
157
- ctx.strokeStyle = !this.activeImgeIndex ? this.visitStrokeStyle || staticStrokeStyle : this.defaultStrokeStyle || staticStrokeStyle;
158
- }
159
- //ctx.strokeStyle = this.dash === 4 ? 'transparent' : this.strokeStyle || '#222';
150
+ ctx.strokeStyle = this.dash === 4 ? 'transparent' : this.strokeStyle || '#222';
160
151
  this.fillStyle && (ctx.fillStyle = this.fillStyle);
161
152
  if (this.lineCap) {
162
153
  ctx.lineCap = this.lineCap;
@@ -248,6 +239,55 @@ var Pen = /** @class */ (function () {
248
239
  this[this.eventFns[item.action]] && this[this.eventFns[item.action]](item.value, item.params);
249
240
  }
250
241
  };
242
+ Pen.prototype.doSocketMqtt = function (item, msg, client) {
243
+ if (item.action < EventAction.Function) {
244
+ this[this.eventFns[item.action]](msg.value || msg || item.value, msg.params || item.params, client);
245
+ }
246
+ else if (item.action < EventAction.SetProps) {
247
+ if (item.action === EventAction.Function && item.value) return this[this.eventFns[item.action]](item.value, msg || item.params, client);
248
+ let jsonNode = msg;
249
+ if (typeof msg === 'string') {
250
+ try {
251
+ jsonNode = JSON.parse(msg);
252
+ }catch (error) { }
253
+ }
254
+ console.log('doSocketMqtt-------------', jsonNode)
255
+ Store.set('mqtt:responseData', jsonNode)
256
+ //const { areaData, assetData, data } = jsonNode
257
+ if (!this.data && this.data.length <= 0 && typeof this.data !== 'object') return
258
+ // const subscribeObj = {
259
+ // areaData, assetData, data,
260
+ // asset: ''
261
+ // }
262
+ jsonNode.asset = ''
263
+ Object.assign(this, setConfItemNode(this, jsonNode))
264
+ }
265
+ else if (item.action === EventAction.SetProps) {
266
+ var props = [];
267
+ var data = msg;
268
+ if (typeof msg === 'string') {
269
+ try {
270
+ data = JSON.parse(msg);
271
+ }
272
+ catch (error) { }
273
+ }
274
+ if (Array.isArray(data)) {
275
+ props = data;
276
+ }
277
+ for (var _i = 0, props_1 = props; _i < props_1.length; _i++) {
278
+ var prop = props_1[_i];
279
+ if (prop.key) {
280
+ if (typeof prop.value === 'object') {
281
+ this[prop.key] = Object.assign(this[prop.key], prop.value);
282
+ }
283
+ else {
284
+ this[prop.key] = prop.value;
285
+ }
286
+ }
287
+ }
288
+ Store.set(this.generateStoreKey('LT:render'), true);
289
+ }
290
+ };
251
291
  Pen.prototype.show = function () {
252
292
  this.visible = true;
253
293
  return this;
@@ -8,10 +8,10 @@ var Rect = /** @class */ (function () {
8
8
  this.height = height;
9
9
  this.center = new Point(0, 0);
10
10
  if (width < 0) {
11
- this.width = 0;
11
+ width = 0;
12
12
  }
13
13
  if (height < 0) {
14
- this.height = 0;
14
+ height = 0;
15
15
  }
16
16
  this.init();
17
17
  }
@@ -0,0 +1,14 @@
1
+ import { TopologyData } from './models';
2
+ export declare class MQTT {
3
+ url: string;
4
+ options: any;
5
+ topics: string;
6
+ data: TopologyData;
7
+ client: any;
8
+ constructor(url: string, options: any, topics: string, data: TopologyData);
9
+ init(): void;
10
+ onmessage: (topic: string, message: any) => void;
11
+ publish(topic: string, message: string): void;
12
+ close(): void;
13
+ isEnd: boolean;
14
+ }
@@ -0,0 +1,82 @@
1
+ import * as mqtt from './mqtt.min.js';
2
+ import { EventType } from './models';
3
+ import { Store } from 'le5le-store';
4
+ var MQTT = /** @class */ (function () {
5
+ function MQTT(url, options, topics, data) {
6
+ var _this = this;
7
+ this.url = url;
8
+ this.options = options;
9
+ this.topics = topics;
10
+ this.data = data;
11
+ this.isEnd = false;
12
+ this.num = 0; // 记录推送的次数,用于判单丢失情况
13
+ this.onmessage = function (topic, message) {
14
+ if (!_this.data.pens.length || !topic || topic != _this.data.mqttTopics) {
15
+ return;
16
+ }
17
+ console.log((new Date()).toString().substring(16,24))
18
+ // 判单推送是否有失丢
19
+ var theNum = JSON.parse(message.toString()).pushNumber
20
+ if((theNum - this.num) > 1) {
21
+ console.log('发生丢失!')
22
+ console.log('上次的计数===',this.num)
23
+ console.log('当前的计数===',theNum)
24
+ // 再次主动请求
25
+ Store.set('mqttLostMessage', true);
26
+ }else{
27
+ Store.set('mqttLostMessage', false);
28
+ }
29
+ this.num = JSON.parse(message.toString()).pushNumber
30
+ console.log('已执行的计数===',this.num)
31
+ console.log('\n')
32
+
33
+ if(!_this.isEnd){
34
+ _this.getPen(_this.data.pens, topics, message)
35
+ }
36
+ };
37
+ //服务器连接异常的回调
38
+ this.onerror= function (error) {
39
+ console.log('服务器连接异常',error)
40
+
41
+ };
42
+ this.init();
43
+ }
44
+ MQTT.prototype.init = function () {
45
+ this.client = mqtt.connect(this.url, this.options);
46
+ console.log('connect===',this.options)
47
+ this.client.on('message', this.onmessage);
48
+ if (this.topics) {
49
+ this.client.subscribe(this.topics.split(','));
50
+ }
51
+ };
52
+ MQTT.prototype.publish = function (topic, message) {
53
+ this.client.publish(topic, message);
54
+ };
55
+ MQTT.prototype.close = function () {
56
+ this.isEnd = true
57
+ this.client.end();
58
+ };
59
+ MQTT.prototype.getPen = function (pens, topics, message) {
60
+ const _this = this;
61
+ pens.forEach((pen)=>{
62
+ if(pen.children != undefined){
63
+ _this.getPen(pen.children, topics, message)
64
+ }else{
65
+ var item = pen;
66
+ for (var _b = 0, _c = item.events; _b < _c.length; _b++) {
67
+ var event_1 = _c[_b];
68
+ if (event_1.type === EventType.Mqtt) {
69
+ event_1.name = topics;
70
+ if(message){
71
+ item.doSocketMqtt(event_1, message.toString(), _this.client);
72
+ }
73
+ }
74
+ }
75
+ }
76
+ })
77
+ };
78
+ return MQTT;
79
+ }());
80
+
81
+ export { MQTT };
82
+ //# sourceMappingURL=mqtt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mqtt.js","sourceRoot":"","sources":["../../../packages/core/src/mqtt.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,IAAI,MAAM,eAAe,CAAC;AAEtC,OAAO,EAAE,SAAS,EAAgB,MAAM,UAAU,CAAC;AAEnD;IAEE,cAAmB,GAAW,EAAS,OAAY,EAAS,MAAc,EAAS,IAAkB;QAArG,iBAEC;QAFkB,QAAG,GAAH,GAAG,CAAQ;QAAS,YAAO,GAAP,OAAO,CAAK;QAAS,WAAM,GAAN,MAAM,CAAQ;QAAS,SAAI,GAAJ,IAAI,CAAc;QAarG,cAAS,GAAG,UAAC,KAAa,EAAE,OAAY;YACtC,IAAI,CAAC,KAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,KAAK,EAAE;gBACpC,OAAO;aACR;YAED,KAAmB,UAAc,EAAd,KAAA,KAAI,CAAC,IAAI,CAAC,IAAI,EAAd,cAAc,EAAd,IAAc,EAAE;gBAA9B,IAAM,IAAI,SAAA;gBACb,KAAoB,UAAW,EAAX,KAAA,IAAI,CAAC,MAAM,EAAX,cAAW,EAAX,IAAW,EAAE;oBAA5B,IAAM,OAAK,SAAA;oBACd,IAAI,OAAK,CAAC,IAAI,KAAK,SAAS,CAAC,IAAI,EAAE;wBACjC,IAAI,OAAK,CAAC,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,OAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE;4BAChD,IAAI,CAAC,YAAY,CAAC,OAAK,EAAE,OAAO,CAAC,QAAQ,EAAE,EAAE,KAAI,CAAC,MAAM,CAAC,CAAC;yBAC3D;qBACF;iBACF;aACF;QACH,CAAC,CAAC;QA1BA,IAAI,CAAC,IAAI,EAAE,CAAC;IACd,CAAC;IAED,mBAAI,GAAJ;QACE,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACnD,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QAE1C,IAAI,IAAI,CAAC,MAAM,EAAE;YACf,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;SAC/C;IACH,CAAC;IAkBD,sBAAO,GAAP,UAAQ,KAAa,EAAE,OAAe;QACpC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACtC,CAAC;IAED,oBAAK,GAAL;QACE,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;IACpB,CAAC;IACH,WAAC;AAAD,CAAC,AAtCD,IAsCC"}
@@ -1,12 +1,15 @@
1
+ import { Options } from './options';
1
2
  import { Canvas } from './canvas';
2
3
  import { ActiveLayer } from './activeLayer';
3
4
  import { HoverLayer } from './hoverLayer';
4
5
  import { AnimateLayer } from './animateLayer';
5
6
  export declare class Offscreen extends Canvas {
7
+ parentElem: HTMLElement;
8
+ options: Options;
6
9
  activeLayer: ActiveLayer;
7
10
  hoverLayer: HoverLayer;
8
11
  animateLayer: AnimateLayer;
9
- constructor(TID: String);
12
+ constructor(parentElem: HTMLElement, options: Options, TID: String);
10
13
  getRoutineLayer(auto?:[]): void;
11
14
  render(): void;
12
15
  destroy(): void;
@@ -13,12 +13,13 @@ var __extends = (this && this.__extends) || (function () {
13
13
  })();
14
14
  import { Store } from 'le5le-store';
15
15
  import { Canvas } from './canvas';
16
- import { Node } from './models'
17
- import { commonStore } from './store'
18
16
  var Offscreen = /** @class */ (function (_super) {
19
17
  __extends(Offscreen, _super);
20
- function Offscreen(TID) {
21
- var _this = _super.call(this, TID) || this;
18
+ function Offscreen(parentElem, options, TID) {
19
+ if (options === void 0) { options = {}; }
20
+ var _this = _super.call(this, parentElem, options, TID) || this;
21
+ _this.parentElem = parentElem;
22
+ _this.options = options;
22
23
  _this.activeLayer = null;
23
24
  _this.hoverLayer = null;
24
25
  _this.animateLayer = null;
@@ -39,12 +40,9 @@ var Offscreen = /** @class */ (function (_super) {
39
40
  Offscreen.prototype.render = function () {
40
41
  _super.prototype.render.call(this);
41
42
  var ctx = this.canvas.getContext('2d');
42
- if(!commonStore || !commonStore[this.TID]) return;
43
- let store = commonStore[this.TID];
44
- ctx.strokeStyle = store.options.color;
45
- for (var _i = 0, _a = store.data.pens; _i < _a.length; _i++) {
43
+ ctx.strokeStyle = this.options.color;
44
+ for (var _i = 0, _a = this.data.pens; _i < _a.length; _i++) {
46
45
  var item = _a[_i];
47
- if(!(item instanceof Node)) item = new Node(item);
48
46
  if (!item.getTID()) {
49
47
  item.setTID(this.TID);
50
48
  }
@@ -59,9 +57,9 @@ var Offscreen = /** @class */ (function (_super) {
59
57
  if(this.animateLayer) {
60
58
  this.animateLayer.render(ctx);
61
59
  }
62
- store = null;
63
60
  };
64
61
  Offscreen.prototype.destroy = function () {
62
+ this.options = null;
65
63
  this.activeLayer = null;
66
64
  this.hoverLayer = null;
67
65
  this.animateLayer = null;
@@ -11,7 +11,6 @@ export declare enum KeydownType {
11
11
  Canvas = 1
12
12
  }
13
13
  export interface Options {
14
- type?: string;
15
14
  cacheLen?: number;
16
15
  extDpiRatio?: number;
17
16
  width?: string | number;
@@ -45,7 +44,7 @@ export interface Options {
45
44
  alwaysAnchor?: boolean;
46
45
  disableEmptyLine?: boolean;
47
46
  disableRepeatLine?: boolean;
48
- disableScale?: boolean; // 禁止缩放
47
+ disableScale?: boolean;
49
48
  disableMoveOutParent?: boolean;
50
49
  disableDockLine?: boolean;
51
50
  playIcon?: string;
@@ -60,7 +59,6 @@ export interface Options {
60
59
  keydown?: KeydownType;
61
60
  viewPadding?: Padding;
62
61
  on?: (event: string, data: any) => void;
63
- storeSubscribe?: boolean
64
62
  }
65
63
  export declare const DefalutOptions: Options;
66
64
 
@@ -38,7 +38,5 @@ export var DefalutOptions = {
38
38
  autoExpandDistance: 200,
39
39
  keydown: KeydownType.Document,
40
40
  viewPadding: 0,
41
- interval: 50,
42
- storeSubscribe: false
43
41
  };
44
42
  //# sourceMappingURL=options.js.map
@@ -0,0 +1,39 @@
1
+ import { EventType } from 'dcim-topology/core/src/models';
2
+
3
+ // 轮询
4
+ var POLL = /** @class */ (function () {
5
+ function POLL(data, message, val) {
6
+ this.data = data;
7
+ this.client = message;
8
+ this.val = val;
9
+ this.init();
10
+ };
11
+ POLL.prototype.init = function () {
12
+ let topics = ''
13
+ this.getPen(this.data.pens, topics, JSON.stringify(this.client))
14
+ };
15
+ POLL.prototype.getPen = function (pens, topics, message) {
16
+ const _this = this;
17
+ pens.forEach((pen)=>{
18
+ if(pen.children != undefined){
19
+ _this.getPen(pen.children, topics, message)
20
+ }else{
21
+ var item = pen;
22
+ for (var _b = 0, _c = item.events; _b < _c.length; _b++) {
23
+ var event_1 = _c[_b];
24
+ // if (event_1.type === EventType.Poll) {
25
+ if ((event_1.type ===3 && this.val === 'Mqtt') || (event_1.type ===4 && this.val === 'Poll')
26
+ || (event_1.type ===5 && this.val === 'Poll1') || (event_1.type ===6 && this.val === 'Poll2')) {
27
+ event_1.name = topics;
28
+ if(message){
29
+ item.doSocketMqtt(event_1, message.toString());
30
+ }
31
+ }
32
+ }
33
+ }
34
+ })
35
+ };
36
+ return POLL;
37
+ }());
38
+ export { POLL };
39
+ //# sourceMappingURL=mqtt.js.map
@@ -1,6 +1,18 @@
1
1
  // @ts-ignore
2
- import {Padding, Options} from './options';
2
+ import {Options, Padding} from './options';
3
+ import { Pen } from './models';
4
+ import { Node } from './models';
3
5
  import { Point } from './models';
6
+ import { Line } from './models';
7
+ import { TopologyData } from './models';
8
+ import { Lock } from './models';
9
+ import { Offscreen } from './offscreen';
10
+ import { RenderLayer } from './renderLayer';
11
+ import { AnimateLayer } from './animateLayer';
12
+ import { DivLayer } from './divLayer';
13
+ import { Rect } from './models';
14
+ import { Socket } from './socket';
15
+ import { MQTT } from './mqtt';
4
16
  import {Common} from './common';
5
17
  export declare class Preview extends Common{
6
18
  constructor(parent: string | HTMLElement, options?: Options);