dcim-topology2d 2.2.3 → 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 (222) 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 +78 -86
  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 +18 -2
  27. package/core/src/activeLayer.d.ts +10 -2
  28. package/core/src/activeLayer.js +62 -57
  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 +68 -69
  33. package/core/src/canvas.d.ts +6 -1
  34. package/core/src/canvas.js +21 -22
  35. package/core/src/common.d.ts +7 -7
  36. package/core/src/common.js +698 -397
  37. package/core/src/core.d.ts +4 -5
  38. package/core/src/core.js +385 -536
  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 +100 -89
  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 -65
  47. package/core/src/middles/index.d.ts +2 -1
  48. package/core/src/middles/index.js +2 -4
  49. package/core/src/middles/nodes/arbitrarygraph.js +9 -11
  50. package/core/src/middles/nodes/pentagon.rect.js +1 -1
  51. package/core/src/middles/nodes/rectangle.js +15 -54
  52. package/core/src/middles/nodes/rectangle.rect.js +1 -1
  53. package/core/src/models/data.d.ts +26 -0
  54. package/core/src/models/data.js +77 -0
  55. package/core/src/models/data.js.map +1 -0
  56. package/core/src/models/index.d.ts +1 -0
  57. package/core/src/models/index.js +1 -0
  58. package/core/src/models/line.js +7 -7
  59. package/core/src/models/node.d.ts +0 -10
  60. package/core/src/models/node.js +101 -155
  61. package/core/src/models/pen.js +68 -37
  62. package/core/src/models/rect.js +2 -2
  63. package/core/src/mqtt.d.ts +14 -0
  64. package/core/src/mqtt.js +82 -0
  65. package/core/src/mqtt.js.map +1 -0
  66. package/core/src/offscreen.d.ts +4 -1
  67. package/core/src/offscreen.js +24 -26
  68. package/core/src/options.d.ts +1 -3
  69. package/core/src/options.js +0 -2
  70. package/core/src/poll.js +39 -0
  71. package/core/src/preview.d.ts +13 -2
  72. package/core/src/preview.js +54 -181
  73. package/core/src/renderLayer.d.ts +9 -11
  74. package/core/src/renderLayer.js +61 -60
  75. package/core/src/socket.d.ts +10 -0
  76. package/core/src/socket.js +51 -0
  77. package/core/src/socket.js.map +1 -0
  78. package/core/src/utils/canvas.js +1 -1
  79. package/core/src/utils/construction.d.ts +3 -36
  80. package/core/src/utils/construction.js +1 -29
  81. package/core/src/utils/conversion.d.ts +0 -15
  82. package/core/src/utils/conversion.js +0 -319
  83. package/core/src/utils/dom.d.ts +8 -0
  84. package/core/src/utils/dom.js +67 -0
  85. package/core/src/utils/dom.js.map +1 -0
  86. package/core/src/utils/index.d.ts +1 -2
  87. package/core/src/utils/index.js +1 -2
  88. package/core/src/utils/onmousevent.d.ts +0 -3
  89. package/core/src/utils/onmousevent.js +10 -42
  90. package/flow-diagram/src/comment/comment.anchor.d.ts +1 -1
  91. package/flow-diagram/src/comment/comment.anchor.js +1 -1
  92. package/flow-diagram/src/comment/comment.d.ts +1 -1
  93. package/flow-diagram/src/data/data.anchor.d.ts +1 -1
  94. package/flow-diagram/src/data/data.anchor.js +1 -1
  95. package/flow-diagram/src/data/data.d.ts +1 -1
  96. package/flow-diagram/src/data/data.rect.d.ts +1 -1
  97. package/flow-diagram/src/data/data.rect.js +1 -1
  98. package/flow-diagram/src/db/db.d.ts +1 -1
  99. package/flow-diagram/src/db/db.rect.d.ts +1 -1
  100. package/flow-diagram/src/db/db.rect.js +1 -1
  101. package/flow-diagram/src/display/display.anchor.d.ts +1 -1
  102. package/flow-diagram/src/display/display.anchor.js +1 -1
  103. package/flow-diagram/src/display/display.d.ts +1 -1
  104. package/flow-diagram/src/display/display.rect.d.ts +1 -1
  105. package/flow-diagram/src/display/display.rect.js +1 -1
  106. package/flow-diagram/src/document/document.anchor.d.ts +1 -1
  107. package/flow-diagram/src/document/document.anchor.js +1 -1
  108. package/flow-diagram/src/document/document.d.ts +1 -1
  109. package/flow-diagram/src/document/document.rect.d.ts +1 -1
  110. package/flow-diagram/src/document/document.rect.js +1 -1
  111. package/flow-diagram/src/externStorage/externStorage.anchor.d.ts +1 -1
  112. package/flow-diagram/src/externStorage/externStorage.anchor.js +1 -1
  113. package/flow-diagram/src/externStorage/externStorage.d.ts +1 -1
  114. package/flow-diagram/src/externStorage/externStorage.rect.d.ts +1 -1
  115. package/flow-diagram/src/externStorage/externStorage.rect.js +1 -1
  116. package/flow-diagram/src/internalStorage/internalStorage.d.ts +1 -1
  117. package/flow-diagram/src/internalStorage/internalStorage.rect.d.ts +1 -1
  118. package/flow-diagram/src/internalStorage/internalStorage.rect.js +1 -1
  119. package/flow-diagram/src/manually/manually.anchor.d.ts +1 -1
  120. package/flow-diagram/src/manually/manually.anchor.js +1 -1
  121. package/flow-diagram/src/manually/manually.d.ts +1 -1
  122. package/flow-diagram/src/manually/manually.rect.d.ts +1 -1
  123. package/flow-diagram/src/manually/manually.rect.js +1 -1
  124. package/flow-diagram/src/parallel/parallel.anchor.d.ts +1 -1
  125. package/flow-diagram/src/parallel/parallel.anchor.js +1 -1
  126. package/flow-diagram/src/parallel/parallel.d.ts +1 -1
  127. package/flow-diagram/src/queue/queue.d.ts +1 -1
  128. package/flow-diagram/src/queue/queue.rect.d.ts +1 -1
  129. package/flow-diagram/src/queue/queue.rect.js +1 -1
  130. package/flow-diagram/src/register.js +1 -1
  131. package/flow-diagram/src/subprocess/subprocess.d.ts +1 -1
  132. package/flow-diagram/src/subprocess/subprocess.rect.d.ts +1 -1
  133. package/flow-diagram/src/subprocess/subprocess.rect.js +1 -1
  134. package/layout/src/align.d.ts +1 -1
  135. package/layout/src/align.js +1 -1
  136. package/layout/src/layout.d.ts +1 -1
  137. package/layout/src/layout.js +1 -1
  138. package/myShape-diagram/{index.js → myShape.js} +1 -4
  139. package/package.json +1 -1
  140. package/sequence-diagram/src/focus/focus.anchor.d.ts +1 -1
  141. package/sequence-diagram/src/focus/focus.anchor.js +1 -1
  142. package/sequence-diagram/src/focus/focus.d.ts +1 -1
  143. package/sequence-diagram/src/focus/focus.rect.d.ts +1 -1
  144. package/sequence-diagram/src/focus/focus.rect.js +1 -1
  145. package/sequence-diagram/src/lifeline/lifeline.anchor.d.ts +1 -1
  146. package/sequence-diagram/src/lifeline/lifeline.anchor.js +1 -1
  147. package/sequence-diagram/src/lifeline/lifeline.d.ts +1 -1
  148. package/sequence-diagram/src/lifeline/lifeline.rect.d.ts +1 -1
  149. package/sequence-diagram/src/lifeline/lifeline.rect.js +1 -1
  150. package/sequence-diagram/src/register.js +1 -1
  151. package/chart-diagram/src/utils/changeOptions.d.ts +0 -8
  152. package/chart-diagram/src/utils/changeOptions.js +0 -273
  153. package/chart-diagram/src/utils/conversion.d.ts +0 -19
  154. package/chart-diagram/src/utils/conversion.js +0 -601
  155. package/chart-diagram/src/utils/drawGraphic.d.ts +0 -3
  156. package/chart-diagram/src/utils/drawGraphic.js +0 -97
  157. package/chart-diagram/src/utils/formatter.d.ts +0 -1
  158. package/chart-diagram/src/utils/formatter.js +0 -206
  159. package/chart-diagram/src/utils/index.d.ts +0 -5
  160. package/chart-diagram/src/utils/index.js +0 -5
  161. package/chart-diagram/src/utils/render.d.ts +0 -8
  162. package/chart-diagram/src/utils/render.js +0 -223
  163. package/chart-diagram/src/utils/surfaceParametricConversion.d.ts +0 -3
  164. package/chart-diagram/src/utils/surfaceParametricConversion.js +0 -252
  165. package/core/src/element/common.d.ts +0 -6
  166. package/core/src/element/common.js +0 -62
  167. package/core/src/element/datePicker.d.ts +0 -3
  168. package/core/src/element/datePicker.js +0 -44
  169. package/core/src/element/iframe.d.ts +0 -3
  170. package/core/src/element/iframe.js +0 -12
  171. package/core/src/element/index.d.ts +0 -5
  172. package/core/src/element/index.js +0 -6
  173. package/core/src/element/select.d.ts +0 -11
  174. package/core/src/element/select.js +0 -273
  175. package/core/src/element/tab.d.ts +0 -1
  176. package/core/src/element/tab.js +0 -20
  177. package/core/src/element/time.d.ts +0 -3
  178. package/core/src/element/time.js +0 -44
  179. package/core/src/middles/arrows/index.d.ts +0 -4
  180. package/core/src/middles/arrows/index.js +0 -5
  181. package/core/src/middles/lines/index.d.ts +0 -4
  182. package/core/src/middles/lines/index.js +0 -5
  183. package/core/src/middles/nodes/formDatePicker.d.ts +0 -2
  184. package/core/src/middles/nodes/formDatePicker.js +0 -108
  185. package/core/src/middles/nodes/formoverflow.js +0 -62
  186. package/core/src/middles/nodes/formselect.d.ts +0 -2
  187. package/core/src/middles/nodes/formselect.js +0 -111
  188. package/core/src/middles/nodes/iframe.d.ts +0 -2
  189. package/core/src/middles/nodes/iframe.js +0 -29
  190. package/core/src/middles/nodes/index.d.ts +0 -52
  191. package/core/src/middles/nodes/index.js +0 -54
  192. package/core/src/middles/nodes/progress.d.ts +0 -2
  193. package/core/src/middles/nodes/progress.js +0 -63
  194. package/core/src/middles/nodes/progress.js.map +0 -1
  195. package/core/src/middles/nodes/switchs.d.ts +0 -2
  196. package/core/src/middles/nodes/switchs.js +0 -46
  197. package/core/src/middles/nodes/time.d.ts +0 -2
  198. package/core/src/middles/nodes/time.js +0 -98
  199. package/core/src/store/common.d.ts +0 -9
  200. package/core/src/store/common.js +0 -5
  201. package/core/src/store/data.d.ts +0 -205
  202. package/core/src/store/data.js +0 -198
  203. package/core/src/store/index.d.ts +0 -2
  204. package/core/src/store/index.js +0 -2
  205. package/core/src/utils/assignment.d.ts +0 -7
  206. package/core/src/utils/assignment.js +0 -229
  207. package/core/src/utils/params.d.ts +0 -3
  208. package/core/src/utils/params.js +0 -136
  209. package/static/echartsDefaultData.js +0 -178
  210. package/static/element.js +0 -14
  211. package/static/form.js +0 -11
  212. package/static/index.js +0 -3
  213. package/store/actions.js +0 -2
  214. package/store/clear.js +0 -14
  215. package/store/default.js +0 -22
  216. package/store/index.js +0 -3
  217. package/style/common.css +0 -15
  218. package/style/datePicker.css +0 -44
  219. package/style/editor.css +0 -16
  220. package/style/index.css +0 -5
  221. package/style/select.css +0 -143
  222. /package/myShape-diagram/{index.d.ts → myShape.ts} +0 -0
@@ -0,0 +1,51 @@
1
+ import { EventType } from './models';
2
+ var Socket = /** @class */ (function () {
3
+ function Socket(url, data) {
4
+ var _this = this;
5
+ this.url = url;
6
+ this.data = data;
7
+ this.onmessage = function (e) {
8
+ if (!_this.data.pens.length || !e || !e.data) {
9
+ return;
10
+ }
11
+ var msg;
12
+ try {
13
+ msg = JSON.parse(e.data);
14
+ }
15
+ catch (error) {
16
+ msg = e.data;
17
+ }
18
+ for (var _i = 0, _a = _this.data.pens; _i < _a.length; _i++) {
19
+ var item = _a[_i];
20
+ for (var _b = 0, _c = item.events; _b < _c.length; _b++) {
21
+ var event_1 = _c[_b];
22
+ if (event_1.type === EventType.WebSocket) {
23
+ if (event_1.name && event_1.name === msg.event) {
24
+ item.doSocketMqtt(event_1, msg.data, _this.socket);
25
+ }
26
+ else if (!event_1.name && msg) {
27
+ item.doSocketMqtt(event_1, msg, _this.socket);
28
+ }
29
+ }
30
+ }
31
+ }
32
+ };
33
+ this.init();
34
+ }
35
+ Socket.prototype.init = function () {
36
+ var _this = this;
37
+ this.socket = new WebSocket(this.url);
38
+ this.socket.onmessage = this.onmessage;
39
+ this.socket.onclose = function () {
40
+ console.log('Canvas websocket closed and reconneting...');
41
+ _this.init();
42
+ };
43
+ };
44
+ Socket.prototype.close = function () {
45
+ this.socket.onclose = null;
46
+ this.socket.close();
47
+ };
48
+ return Socket;
49
+ }());
50
+ export { Socket };
51
+ //# sourceMappingURL=socket.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"socket.js","sourceRoot":"","sources":["../../../packages/core/src/socket.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAgB,MAAM,UAAU,CAAC;AAEnD;IAEE,gBAAmB,GAAW,EAAS,IAAkB;QAAzD,iBAEC;QAFkB,QAAG,GAAH,GAAG,CAAQ;QAAS,SAAI,GAAJ,IAAI,CAAc;QAczD,cAAS,GAAG,UAAC,CAAe;YAC1B,IAAI,CAAC,KAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE;gBAC3C,OAAO;aACR;YAED,IAAI,GAAkC,CAAC;YACvC,IAAI;gBACF,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;aAC1B;YAAC,OAAO,KAAK,EAAE;gBACd,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC;aACd;YAED,KAAmB,UAAc,EAAd,KAAA,KAAI,CAAC,IAAI,CAAC,IAAI,EAAd,cAAc,EAAd,IAAc,EAAE;gBAA9B,IAAM,IAAI,SAAA;gBACb,KAAoB,UAAW,EAAX,KAAA,IAAI,CAAC,MAAM,EAAX,cAAW,EAAX,IAAW,EAAE;oBAA5B,IAAM,OAAK,SAAA;oBACd,IAAI,OAAK,CAAC,IAAI,KAAK,SAAS,CAAC,SAAS,EAAE;wBACtC,IAAI,OAAK,CAAC,IAAI,IAAI,OAAK,CAAC,IAAI,KAAK,GAAG,CAAC,KAAK,EAAE;4BAC1C,IAAI,CAAC,YAAY,CAAC,OAAK,EAAE,GAAG,CAAC,IAAI,EAAE,KAAI,CAAC,MAAM,CAAC,CAAC;yBACjD;6BAAM,IAAI,CAAC,OAAK,CAAC,IAAI,IAAI,GAAG,EAAE;4BAC7B,IAAI,CAAC,YAAY,CAAC,OAAK,EAAE,GAAG,EAAE,KAAI,CAAC,MAAM,CAAC,CAAC;yBAC5C;qBACF;iBACF;aACF;QACH,CAAC,CAAC;QApCA,IAAI,CAAC,IAAI,EAAE,CAAC;IACd,CAAC;IAED,qBAAI,GAAJ;QAAA,iBAQC;QAPC,IAAI,CAAC,MAAM,GAAG,IAAI,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACtC,IAAI,CAAC,MAAM,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QAEvC,IAAI,CAAC,MAAM,CAAC,OAAO,GAAG;YACpB,OAAO,CAAC,GAAG,CAAC,4CAA4C,CAAC,CAAC;YAC1D,KAAI,CAAC,IAAI,EAAE,CAAC;QACd,CAAC,CAAC;IACJ,CAAC;IA2BD,sBAAK,GAAL;QACE,IAAI,CAAC,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC;QAC3B,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IACtB,CAAC;IACH,aAAC;AAAD,CAAC,AA7CD,IA6CC"}
@@ -1,4 +1,4 @@
1
- import { Point } from '../models';
1
+ import { Point } from '../models/point';
2
2
  export function flatNodes(nodes) {
3
3
  var result = {
4
4
  nodes: [],
@@ -1,6 +1,4 @@
1
1
  // @ts-ignore
2
- export declare const echartsStaticType: Array<string> = [];
3
- // @ts-ignore
4
2
  export declare const winEventActionFns: Array<string> = [];
5
3
  export interface MoveDataType {
6
4
  None?: string | number;
@@ -14,18 +12,20 @@ export interface MoveDataType {
14
12
  HoverAnchors?: string | number;
15
13
  Rotate?: string | number;
16
14
  }
15
+ export const moveDataType: MoveDataType;
17
16
  export interface DownDataType {
18
17
  Window?: string | number;
19
18
  Target?: string | number;
20
19
  Showhide?: string | number;
21
20
  Tabswitch?: string | number;
22
- Formselect?: string | number;
23
21
  }
22
+ export const downDataType: DownDataType;
24
23
  export interface PreviewType {
25
24
  Dcim?: string;
26
25
  Topology?: string;
27
26
  Logo?: string;
28
27
  }
28
+ export const previewType: PreviewType;
29
29
  export interface AnimateType {
30
30
  LeftFlow?: string;
31
31
  RightFlow?: string;
@@ -38,37 +38,4 @@ export interface AnimateType {
38
38
  Show?: string;
39
39
  Rotate?: string;
40
40
  }
41
- export interface SelectStaticType {
42
- static?:number;
43
- dataShow?:number;
44
- visible?:number;
45
- }
46
- export interface DatePickerBindType {
47
- echarts?:number;
48
- tag?:number;
49
- kpi?:number;
50
- asset?:number;
51
- area?:number;
52
- varType?:number;
53
- branch?:number;
54
- word?:number;
55
- }
56
- export interface ConfBindValueType {
57
- increment?:number; // 增量值
58
- current?:number; // 当前值
59
- max?:number; // 最大值
60
- min?:number; // 最小值
61
- average?:number; // 平均值
62
- }
63
- export interface ConfAssociateDateValueShowType {
64
- real?:number; // 实时值
65
- date?:number; // 日期值
66
- }
67
- export const moveDataType: MoveDataType;
68
- export const downDataType: DownDataType;
69
- export const previewType: PreviewType;
70
41
  export const animateType: AnimateType;
71
- export const selectStaticType: SelectStaticType;
72
- export const datePickerBindType: DatePickerBindType;
73
- export const confBindValueType: ConfBindValueType;
74
- export const confAssociateDateValueShowType: ConfAssociateDateValueShowType;
@@ -1,4 +1,3 @@
1
- export const echartsStaticType = ['DAY', 'WEEK', 'MONTH', 'YEAR', 'REALTIME', 'CUSTOMIZE'];
2
1
  export const winEventActionFns = ['Link', 'DoAnimate', 'DoFn', 'DoWindowFn', 'openImg'];
3
2
  export const moveDataType = {
4
3
  None: 0,
@@ -16,8 +15,7 @@ export const downDataType = {
16
15
  Window: 'window',
17
16
  Target: 'target',
18
17
  Showhide: 'showhide',
19
- Tabswitch: 'Tabswitch',
20
- Formselect: 'Formselect'
18
+ Tabswitch: 'Tabswitch'
21
19
  };
22
20
  export const previewType = {
23
21
  Dcim: 'dcim',
@@ -35,30 +33,4 @@ export const animateType = {
35
33
  Error: 'error',
36
34
  Show: 'show',
37
35
  Rotate: 'rotate'
38
- };
39
- export const selectStaticType = {
40
- static: 1,
41
- dataShow: 2,
42
- visible: 3
43
- };
44
- export const datePickerBindType = {
45
- echarts: 1, // echart
46
- tag: 3, // 测点
47
- kpi: 6, // 指标
48
- asset: 9, // 资产
49
- area: 21, // 区域
50
- varType: 12, // 变量类型
51
- branch: 15, // 支路地址
52
- word: -1 // 文字
53
- };
54
- export const confBindValueType = {
55
- increment: 1, // 增量值
56
- current: 2, // 当前值
57
- max: 3, // 最大值
58
- min: 4, // 最小值
59
- average: 5 // 平均值
60
- };
61
- export const confAssociateDateValueShowType = {
62
- real: 1, // 实时值
63
- date: 2 // 日期值
64
36
  };
@@ -1,15 +0,0 @@
1
- import {Node} from "../models";
2
- export declare function pageZoom(): number;
3
- export declare function datePickerValueFormatting(data: {}): {};
4
- export declare function getTabConnectSHConf(node: Node): Node;
5
- export declare function tabStaticOperation(type: string, node: Node, areaData: any, params: object): void;
6
- export declare function tabHideShowOperation(node: any, areaData: any, visible: boolean): void;
7
- export declare function getEchartsRealData(node: {}, data: []): void;
8
- export declare function setInitConfData(id: string, data: object): void;
9
- export declare function setTagIdData(data: any): [];
10
- export declare function setKpiAddrData(data: any): [];
11
- export declare function setAssetIdData(data: any): [];
12
- export declare function setAreaIdData(data: any): [];
13
- export declare function setVarValueData(data: any): [];
14
- export declare function setBranchAddressData(data: any): [];
15
- export declare function setThreeCategoryIdData(pen: Node, data: any): [];
@@ -1,319 +0,0 @@
1
- import {commonStore} from '../store';
2
- import {setElementSwitchTabState} from '../element';
3
- import {echartsStaticType} from '../utils';
4
- import {datePickerType, datePickerTypeList} from "../../../store";
5
-
6
- /**
7
- * yyyy-MM-dd 格式转换
8
- * @param valueType 默认值类型:1-默认当天
9
- * @returns {string}
10
- */
11
- // function yyyMMddFormatting(valueType) {
12
- // if(valueType === 1){
13
- // // 默认当天
14
- // return new Date().toISOString().split('T')[0];
15
- // }
16
- // }
17
-
18
- /**
19
- * yyyy-MM-dd HH:mm:ss 格式转换
20
- * @param valueType 默认值类型:1-默认当天
21
- * @returns {string}
22
- */
23
- // function yyyMMddHHmmssFormatting(valueType) {
24
- // if(valueType === 1){
25
- // // 默认当天
26
- // return new Date().toISOString().replace('T', ' ').substring(0, 19);
27
- // }
28
- // }
29
-
30
- /**
31
- * yyyy 格式转换
32
- * @param valueType 默认值类型:1-默认当天
33
- * @returns {number}
34
- */
35
- // function yyyFormatting(valueType) {
36
- // if(valueType === 1){
37
- // // 默认当天
38
- // return new new Date().getFullYear();
39
- // }
40
- // }
41
-
42
- /**
43
- * yyyy-MM 格式转换
44
- * @param valueType 默认值类型:1-默认当天
45
- * @returns {string}
46
- */
47
- // function yyyMMFormatting(valueType) {
48
- // if(valueType === 1){
49
- // // 默认当天
50
- // return new Date().toISOString().slice(0, 7);
51
- // }
52
- // }
53
-
54
- /**
55
- * HH:mm:ss 格式转换
56
- * @param valueType 默认值类型:1-默认当天
57
- * @returns {string}
58
- */
59
- // function hhmmssddFormatting(valueType) {
60
- // if(valueType === 1){
61
- // // 默认当天
62
- // Date.prototype.formatTime = function() {
63
- // return [this.getHours(), this.getMinutes(), this.getSeconds()]
64
- // .map(v => v.toString().padStart(2, '0')).join(':');
65
- // };
66
- // return new Date().formatTime();
67
- // }
68
- // }
69
- export function pageZoom() {
70
- let screenWidth = 0;
71
- if(window.screen.width < 1920) {
72
- // 1920 * 1080分辨率以下的适配
73
- const zoom = window.screen.width / 1920;
74
- screenWidth = Math.round(window.screen.width / zoom);
75
- }else {
76
- screenWidth = window.screen.width;
77
- }
78
- const order = window.screen.width > 1280 ? 12 : 8; // 差值计算
79
- return window.innerWidth < screenWidth ? (window.innerWidth - order) / screenWidth : 1;
80
- }
81
-
82
- /**
83
- * 日期转换
84
- * @param data: {formatType: '日期格式', valueType: '默认值类型'}
85
- * @returns {string}
86
- */
87
- export function datePickerValueFormatting(data) {
88
- if(!Object.keys(datePickerType).length) {
89
- // 获取日期类型map数据
90
- const params = datePickerTypeList.reduce((obj, item) => {
91
- obj[item['id']] = item.format;
92
- return obj;
93
- }, {});
94
- Object.assign(datePickerType, params);
95
- }
96
- let now = new Date(); // data.valueType === 1 默认
97
- const map = {
98
- yyyy: now.getFullYear(),
99
- MM: String(now.getMonth() + 1).padStart(2, '0'),
100
- dd: String(now.getDate()).padStart(2, '0'),
101
- HH: String(now.getHours()).padStart(2, '0'),
102
- mm: String(now.getMinutes()).padStart(2, '0'),
103
- ss: String(now.getSeconds()).padStart(2, '0')
104
- };
105
- const date = data.dateType ? datePickerType[data.dateType].replace(/yyyy|MM|dd|HH|mm|ss/g, match => map[match]) : '';
106
- const dateStr = data.formatType.replace(/yyyy|MM|dd|HH|mm|ss/g, match => map[match]);
107
- return {
108
- date,
109
- dateStr
110
- };
111
- }
112
- // tab切换页签删除数据处理
113
- export function getTabConnectSHConf(node) {
114
- const switchTabType = node.tags.find((t) => {
115
- return t.includes('switchTabType');
116
- }); // 获取按钮组类型
117
- const topologyChangeData = commonStore[node.TID].switchTabDataPool;
118
- const tabAreaData = topologyChangeData[`${switchTabType}AreaData`];
119
- const bindConfIds = node.bindStaticId.split(','); // tab元件绑定的元件id
120
- const currentNode = [{...node}]; // 需要删除的关联元件数据
121
- for (let i = 0; i < bindConfIds.length; i++) {
122
- const id = bindConfIds[i];
123
- if(tabAreaData[id]) {
124
- currentNode.push(tabAreaData[id]);
125
- delete tabAreaData[id];
126
- }
127
- }
128
- const changeData = topologyChangeData[`${switchTabType}Data`];
129
- delete changeData[node.id];
130
- if(Object.keys(changeData).length) {
131
- // 第一个页签设置选中效果
132
- const firstNode = Object.values(changeData)[0];
133
- firstNode.activeImgeIndex = false;
134
- const firstNodeBindConfIds = firstNode.bindStaticId.split(','); // tab元件绑定的元件id
135
- // 为绑定的每个元件设置可见
136
- for (let i = 0; i < firstNodeBindConfIds.length; i++) {
137
- const tabAreaNode = tabAreaData[firstNodeBindConfIds[i]];
138
- if(tabAreaNode) {
139
- tabAreaNode.visible = true;
140
- tabAreaNode.visibleSwitch = true;
141
- }
142
- }
143
- }
144
- return currentNode;
145
- }
146
- /**
147
- * Tab 数据统计
148
- * @param type 统计类型
149
- * @param node 元件数据
150
- * @param areaData tab展示区域数据
151
- * @param params Tab 切换选中参数
152
- */
153
- export function tabStaticOperation(type, node, areaData, params) {
154
- if(!node.bindStaticId || !(echartsStaticType.includes(type) || type === 'OTHER')) return;
155
- const curentEchart = areaData && areaData[node.bindStaticId]; // 获取当前点中的节点绑定的统计图表数据
156
- if(!curentEchart || !curentEchart.data.params) return console.log('未能找到匹配的echarts图表>>>');
157
- const currentStore = commonStore[node.TID];
158
- const echartNode = currentStore.data.pens[curentEchart.order]; // 获取tab 绑定的图表元件数据
159
- if(type === 'OTHER') {
160
- const tabCorrelationType = currentStore.echartsDataPool[node.bindStaticId].tabCorrelationType; // 获取select与tab关联的标识
161
- const optionNode = currentStore.echartsOptionsPool[node.bindStaticId];
162
- if(tabCorrelationType === 'select') {
163
- // tab类型为包含在select下的切换则执行下面的逻辑
164
- echartNode.data.params['tabVisitOrder'] = params.order;
165
- }else {
166
- // 非 年、月、日、周、实时类型的切换
167
- const groupData = currentStore.selectRealDataPool[node.bindStaticId];
168
- if (optionNode) currentStore.echartsRealDataPool[optionNode.data.id] = currentStore.echartsRealDataPool[groupData[params.order].id];
169
- }
170
- if(optionNode) optionNode.data.tabData = {
171
- type,
172
- data: params.data
173
- };
174
- }
175
- echartNode.data.params['staticForType'] = type
176
- echartNode.elementRendered = false;
177
- }
178
- /**
179
- * Tab 显示/隐藏切换
180
- * @param node tab页签数据
181
- * @param areaData // tab展示区域数据
182
- * @param isActive
183
- */
184
- export function tabHideShowOperation(node, areaData, isActive) {
185
- const confIds = node.bindStaticId && node.bindStaticId.split(',') || [];
186
- const pens = commonStore[node.TID].data.pens;
187
- for (let i = 0; i < confIds.length; i++) {
188
- const confid = confIds[i];
189
- const areaNode = areaData[confid];
190
- if(!(areaNode && pens[areaNode.order])) return;
191
- const tagNode = pens[areaNode.order];
192
- tagNode.visible = !isActive;
193
- tagNode.visibleSwitch = tagNode.visible;
194
- setElementSwitchTabState(tagNode);
195
- }
196
- }
197
- /**
198
- * 获取echarts和select实时数据
199
- * @param node 节点
200
- * @param data 实时数据
201
- */
202
- export function getEchartsRealData(node, data){
203
- const currentStore = commonStore[node.TID];
204
- if(!currentStore.selectRealDataPool[node.id]) {
205
- const selectData = [];
206
- let currentData = null;
207
- data.map((item, index) => {
208
- if(index === 0) currentData = item;
209
- selectData.push({
210
- id: item.id,
211
- name: item.aliasName
212
- });
213
- currentStore.echartsRealDataPool[item.id] = item;
214
- });
215
- currentStore.echartsRealDataPool[node.id] = currentData;
216
- currentStore.selectRealDataPool[node.id] = selectData;
217
- }else {
218
- const selectId = currentStore.echartsDataPool[node.id] && currentStore.echartsDataPool[node.id].bindId;
219
- const selected = selectId && currentStore.selectDataPool[selectId] && currentStore.selectDataPool[selectId].node.selected;
220
- if(selected && selected.id) {
221
- // 如有选中的数据
222
- currentStore.echartsRealDataPool[node.id] = currentStore.echartsRealDataPool[selected.id];
223
- }else {
224
- currentStore.echartsRealDataPool[node.id] = data[0];
225
- }
226
- }
227
- }
228
- export function setInitConfData(id, data){
229
- if(commonStore[id].initConfNode[data.id]) return;
230
- const bindMqttNode = data.events.find((ev) => {return ev.type === 3});
231
- if(!bindMqttNode) return;
232
- const initNode = {
233
- text: data.text,
234
- font: data.font,
235
- strokeStyle: data.strokeStyle,
236
- fillStyle: data.fillStyle,
237
- image: data.image,
238
- leakageEnd: data.leakageEnd,
239
- leakageFillStyle: data.leakageFillStyle,
240
- leakageStart: data.leakageStart
241
- }
242
- if(data.name === 'echarts') initNode.data = data.data;
243
- commonStore[id].initConfNode[data.id] = initNode;
244
- }
245
- export function setTagIdData(data) {
246
- return [{
247
- "key": "tagId",
248
- "value": data.tagId,
249
- "isControlDis": data.isControlDis,
250
- "type": data.tagType,
251
- "tagVal": data.value,
252
- "valExplain": data.valExplain,
253
- "tagId": data.tagId
254
- }, {
255
- "key": "测点名称",
256
- "value": data.tagName
257
- }];
258
- }
259
- export function setKpiAddrData(data) {
260
- return [{
261
- "key": "kpiAddr",
262
- "value": data.kpiId + '_' + data.kpiAddr,
263
- "isControlDis": data.isControlDis,
264
- "type": data.tagType
265
- }, {
266
- "key": "指标名称",
267
- "value": data.kpiName
268
- }];
269
- }
270
- export function setAssetIdData(data) {
271
- return [{
272
- "key": "assetId",
273
- "value": data.id
274
- }, {
275
- "key": "资产名称",
276
- "value": data.name
277
- }];
278
- }
279
- export function setAreaIdData(data) {
280
- return [{
281
- "key": "areaId",
282
- "value": data.id
283
- }, {
284
- "key": "区域名称",
285
- "value": data.name
286
- }];
287
- }
288
- export function setVarValueData(data) {
289
- return [{
290
- "key": "varId",
291
- "value": data.id
292
- },{
293
- "key": "varValue",
294
- "value": data.value
295
- }, {
296
- "key": "变量类型名称",
297
- "value": data.name
298
- }];
299
- }
300
- export function setBranchAddressData(data) {
301
- return [{
302
- "key": "branchVal",
303
- "value": data.value
304
- }, {
305
- "key": "支路地址Key",
306
- "value": data.key
307
- }];
308
- }
309
- export function setThreeCategoryIdData(pen, data) {
310
- let params = [];
311
- const hasThreeCategoryId = pen.data.find((tc) => {
312
- return tc.key === 'threeCategoryId' && tc.value === data.threeCategoryId;
313
- });
314
- if(!hasThreeCategoryId) params = [{
315
- "key": "threeCategoryId",
316
- "value": data.threeCategoryId
317
- }];
318
- return params;
319
- }
@@ -0,0 +1,8 @@
1
+ import { Node } from '../models/node';
2
+ // @ts-ignore
3
+ import { TopologyData } from 'dcim-topology/core'
4
+ export declare let DomElements: {};
5
+ export declare function createChildrenDivByElementId(node: Node, data?: TopologyData): HTMLDivElement;
6
+ export declare function setStyleForElementIdDiv(node: Node, elem: HTMLElement, data: TopologyData): void;
7
+ export declare function createDiv(node: Node): HTMLDivElement;
8
+ export declare function loadJS(url: string, callback?: () => void, render?: boolean): void;
@@ -0,0 +1,67 @@
1
+ import { Store } from 'le5le-store';
2
+ import { Lock } from 'dcim-topology/core/src/models/status'
3
+ export let DomElements = {};
4
+ export function createChildrenDivByElementId(node, data) {
5
+ if (!DomElements[node.id]) {
6
+ DomElements[node.id] = document.getElementById(node.id);
7
+ if (DomElements[node.id]) {
8
+ document.querySelector('.canvas-point').appendChild(DomElements[node.id]);
9
+ }
10
+ }
11
+ setStyleForElementIdDiv(node, DomElements[node.id], data);
12
+ }
13
+ export function setStyleForElementIdDiv(node, elem, data) {
14
+ if (!elem) {
15
+ return;
16
+ }
17
+ elem.style.position = 'absolute';
18
+ elem.style.outline = 'none';
19
+ elem.style.left = node.rect.x + 'px';
20
+ elem.style.top = node.rect.y + 'px';
21
+ elem.style.width = node.rect.width + 'px';
22
+ elem.style.height = node.rect.height + 'px';
23
+ if (node.rotate || node.offsetRotate) {
24
+ elem.style.transform = "rotate(" + (node.rotate + node.offsetRotate) + "deg)";
25
+ }
26
+ // if (node.video && this.videos[node.id] && this.videos[node.id].media) {
27
+ // this.videos[node.id].media.style.width = '100%';
28
+ // this.videos[node.id].media.style.height = '100%';
29
+ // }
30
+ if (data && data.locked > Lock.None || node.locked > Lock.None) {
31
+ elem.style.userSelect = 'initial';
32
+ elem.style.pointerEvents = 'initial';
33
+ } else {
34
+ elem.style.userSelect = 'none';
35
+ elem.style.pointerEvents = 'none';
36
+ }
37
+ }
38
+ export function createDiv(node) {
39
+ var div = document.createElement('div');
40
+ div.style.position = 'absolute';
41
+ div.style.outline = 'none';
42
+ div.style.left = '-9999px';
43
+ div.style.bottom = '-9999px';
44
+ div.style.width = node.rect.width + 'px';
45
+ div.style.height = node.rect.height + 'px';
46
+ // if (node.elementId) {
47
+ // div.id = node.elementId;
48
+ // }
49
+ div.id = node.id;
50
+ return div;
51
+ }
52
+ export function loadJS(url, callback, render) {
53
+ var loaderScript = document.createElement('script');
54
+ loaderScript.type = 'text/javascript';
55
+ loaderScript.src = url;
56
+ loaderScript.addEventListener('load', function () {
57
+ if (callback) {
58
+ callback();
59
+ }
60
+ // how to do
61
+ if (render) {
62
+ Store.set('LT:render', true);
63
+ }
64
+ });
65
+ document.body.appendChild(loaderScript);
66
+ }
67
+ //# sourceMappingURL=dom.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dom.js","sourceRoot":"","sources":["../../../../packages/core/src/utils/dom.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAIpC,MAAM,UAAU,SAAS,CAAC,IAAU;IAClC,IAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAC1C,GAAG,CAAC,KAAK,CAAC,QAAQ,GAAG,UAAU,CAAC;IAChC,GAAG,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;IAC3B,GAAG,CAAC,KAAK,CAAC,IAAI,GAAG,SAAS,CAAC;IAC3B,GAAG,CAAC,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC;IAC7B,GAAG,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACzC,GAAG,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;IAC3C,IAAI,IAAI,CAAC,SAAS,EAAE;QAClB,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC;KACzB;IAED,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,GAAW,EAAE,QAAqB,EAAE,MAAgB;IACzE,IAAM,YAAY,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IACtD,YAAY,CAAC,IAAI,GAAG,iBAAiB,CAAC;IACtC,YAAY,CAAC,GAAG,GAAG,GAAG,CAAC;IACvB,YAAY,CAAC,gBAAgB,CAAC,MAAM,EAAE;QACpC,IAAI,QAAQ,EAAE;YACZ,QAAQ,EAAE,CAAC;SACZ;QACD,YAAY;QACZ,IAAI,MAAM,EAAE;YACV,KAAK,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;SAC9B;IACH,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;AAC1C,CAAC"}
@@ -1,4 +1,5 @@
1
1
  export * from './canvas';
2
+ export * from './dom';
2
3
  export * from './math';
3
4
  export * from './rect';
4
5
  export * from './uuid';
@@ -6,5 +7,3 @@ export * from './padding'
6
7
  export * from './construction';
7
8
  export * from './onmousevent';
8
9
  export * from './conversion';
9
- export * from './assignment';
10
- export * from './params';
@@ -1,4 +1,5 @@
1
1
  export * from './canvas';
2
+ export * from './dom';
2
3
  export * from './math';
3
4
  export * from './rect';
4
5
  export * from './uuid';
@@ -6,6 +7,4 @@ export * from './padding'
6
7
  export * from './construction';
7
8
  export * from './onmousevent';
8
9
  export * from './conversion';
9
- export * from './assignment';
10
- export * from './params';
11
10
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,3 @@
1
- import {Node} from '../models';
2
-
3
- export declare function setEventListener(e: Event, TID: string, node: Node): any;
4
1
  export declare function mousMoveFun(type: string, data: any): object;
5
2
  export declare function mousDownFun(type: string, eventNode: object): object;
6
3
  export declare function omouseEventPrototDoWindowFn(eventNode: object, node: object): string;