dcim-topology2d 1.1.6 → 3.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (168) 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 +0 -2
  17. package/chart-diagram/index.js +0 -1
  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 -1
  26. package/core/index.js +0 -1
  27. package/core/src/activeLayer.d.ts +10 -2
  28. package/core/src/activeLayer.js +41 -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 -17
  35. package/core/src/common.d.ts +5 -5
  36. package/core/src/common.js +202 -172
  37. package/core/src/core.d.ts +4 -3
  38. package/core/src/core.js +321 -339
  39. package/core/src/divLayer.d.ts +33 -2
  40. package/core/src/divLayer.js +292 -41
  41. package/core/src/healps/changeData.d.ts +1 -1
  42. package/core/src/healps/changeData.js +44 -102
  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 -51
  47. package/core/src/middles/index.js +2 -3
  48. package/core/src/middles/nodes/pentagon.rect.js +1 -1
  49. package/core/src/middles/nodes/rectangle.rect.js +1 -1
  50. package/core/src/models/data.d.ts +26 -0
  51. package/core/src/models/data.js +77 -0
  52. package/core/src/models/data.js.map +1 -0
  53. package/core/src/models/index.d.ts +1 -0
  54. package/core/src/models/index.js +1 -0
  55. package/core/src/models/node.d.ts +0 -6
  56. package/core/src/models/node.js +16 -29
  57. package/core/src/models/pen.js +7 -16
  58. package/core/src/mqtt.d.ts +14 -0
  59. package/core/src/mqtt.js +82 -0
  60. package/core/src/mqtt.js.map +1 -0
  61. package/core/src/offscreen.d.ts +4 -1
  62. package/core/src/offscreen.js +8 -10
  63. package/core/src/options.js +0 -1
  64. package/core/src/poll.js +2 -0
  65. package/core/src/preview.d.ts +13 -1
  66. package/core/src/preview.js +34 -56
  67. package/core/src/renderLayer.d.ts +3 -1
  68. package/core/src/renderLayer.js +31 -26
  69. package/core/src/socket.d.ts +10 -0
  70. package/core/src/socket.js +51 -0
  71. package/core/src/socket.js.map +1 -0
  72. package/core/src/utils/canvas.js +1 -1
  73. package/core/src/utils/conversion.d.ts +0 -7
  74. package/core/src/utils/conversion.js +0 -54
  75. package/core/src/utils/dom.d.ts +5 -6
  76. package/core/src/utils/dom.js +46 -82
  77. package/core/src/utils/index.d.ts +0 -1
  78. package/core/src/utils/index.js +0 -1
  79. package/core/src/utils/onmousevent.js +3 -12
  80. package/flow-diagram/src/comment/comment.anchor.d.ts +1 -1
  81. package/flow-diagram/src/comment/comment.anchor.js +1 -1
  82. package/flow-diagram/src/comment/comment.d.ts +1 -1
  83. package/flow-diagram/src/data/data.anchor.d.ts +1 -1
  84. package/flow-diagram/src/data/data.anchor.js +1 -1
  85. package/flow-diagram/src/data/data.d.ts +1 -1
  86. package/flow-diagram/src/data/data.rect.d.ts +1 -1
  87. package/flow-diagram/src/data/data.rect.js +1 -1
  88. package/flow-diagram/src/db/db.d.ts +1 -1
  89. package/flow-diagram/src/db/db.rect.d.ts +1 -1
  90. package/flow-diagram/src/db/db.rect.js +1 -1
  91. package/flow-diagram/src/display/display.anchor.d.ts +1 -1
  92. package/flow-diagram/src/display/display.anchor.js +1 -1
  93. package/flow-diagram/src/display/display.d.ts +1 -1
  94. package/flow-diagram/src/display/display.rect.d.ts +1 -1
  95. package/flow-diagram/src/display/display.rect.js +1 -1
  96. package/flow-diagram/src/document/document.anchor.d.ts +1 -1
  97. package/flow-diagram/src/document/document.anchor.js +1 -1
  98. package/flow-diagram/src/document/document.d.ts +1 -1
  99. package/flow-diagram/src/document/document.rect.d.ts +1 -1
  100. package/flow-diagram/src/document/document.rect.js +1 -1
  101. package/flow-diagram/src/externStorage/externStorage.anchor.d.ts +1 -1
  102. package/flow-diagram/src/externStorage/externStorage.anchor.js +1 -1
  103. package/flow-diagram/src/externStorage/externStorage.d.ts +1 -1
  104. package/flow-diagram/src/externStorage/externStorage.rect.d.ts +1 -1
  105. package/flow-diagram/src/externStorage/externStorage.rect.js +1 -1
  106. package/flow-diagram/src/internalStorage/internalStorage.d.ts +1 -1
  107. package/flow-diagram/src/internalStorage/internalStorage.rect.d.ts +1 -1
  108. package/flow-diagram/src/internalStorage/internalStorage.rect.js +1 -1
  109. package/flow-diagram/src/manually/manually.anchor.d.ts +1 -1
  110. package/flow-diagram/src/manually/manually.anchor.js +1 -1
  111. package/flow-diagram/src/manually/manually.d.ts +1 -1
  112. package/flow-diagram/src/manually/manually.rect.d.ts +1 -1
  113. package/flow-diagram/src/manually/manually.rect.js +1 -1
  114. package/flow-diagram/src/parallel/parallel.anchor.d.ts +1 -1
  115. package/flow-diagram/src/parallel/parallel.anchor.js +1 -1
  116. package/flow-diagram/src/parallel/parallel.d.ts +1 -1
  117. package/flow-diagram/src/queue/queue.d.ts +1 -1
  118. package/flow-diagram/src/queue/queue.rect.d.ts +1 -1
  119. package/flow-diagram/src/queue/queue.rect.js +1 -1
  120. package/flow-diagram/src/register.js +1 -1
  121. package/flow-diagram/src/subprocess/subprocess.d.ts +1 -1
  122. package/flow-diagram/src/subprocess/subprocess.rect.d.ts +1 -1
  123. package/flow-diagram/src/subprocess/subprocess.rect.js +1 -1
  124. package/layout/src/align.d.ts +1 -1
  125. package/layout/src/align.js +1 -1
  126. package/layout/src/layout.d.ts +1 -1
  127. package/layout/src/layout.js +1 -1
  128. package/myShape-diagram/myShape.js +1 -1
  129. package/package.json +1 -1
  130. package/sequence-diagram/src/focus/focus.anchor.d.ts +1 -1
  131. package/sequence-diagram/src/focus/focus.anchor.js +1 -1
  132. package/sequence-diagram/src/focus/focus.d.ts +1 -1
  133. package/sequence-diagram/src/focus/focus.rect.d.ts +1 -1
  134. package/sequence-diagram/src/focus/focus.rect.js +1 -1
  135. package/sequence-diagram/src/lifeline/lifeline.anchor.d.ts +1 -1
  136. package/sequence-diagram/src/lifeline/lifeline.anchor.js +1 -1
  137. package/sequence-diagram/src/lifeline/lifeline.d.ts +1 -1
  138. package/sequence-diagram/src/lifeline/lifeline.rect.d.ts +1 -1
  139. package/sequence-diagram/src/lifeline/lifeline.rect.js +1 -1
  140. package/sequence-diagram/src/register.js +1 -1
  141. package/chart-diagram/src/utils/changeOptions.d.ts +0 -4
  142. package/chart-diagram/src/utils/changeOptions.js +0 -163
  143. package/chart-diagram/src/utils/conversion.d.ts +0 -17
  144. package/chart-diagram/src/utils/conversion.js +0 -179
  145. package/chart-diagram/src/utils/drawGraphic.d.ts +0 -3
  146. package/chart-diagram/src/utils/drawGraphic.js +0 -97
  147. package/chart-diagram/src/utils/index.d.ts +0 -3
  148. package/chart-diagram/src/utils/index.js +0 -3
  149. package/core/src/middles/arrows/index.d.ts +0 -4
  150. package/core/src/middles/arrows/index.js +0 -5
  151. package/core/src/middles/lines/index.d.ts +0 -4
  152. package/core/src/middles/lines/index.js +0 -5
  153. package/core/src/middles/nodes/iframe.d.ts +0 -2
  154. package/core/src/middles/nodes/iframe.js +0 -12
  155. package/core/src/middles/nodes/index.d.ts +0 -46
  156. package/core/src/middles/nodes/index.js +0 -47
  157. package/core/src/store/common.d.ts +0 -9
  158. package/core/src/store/common.js +0 -5
  159. package/core/src/store/data.d.ts +0 -129
  160. package/core/src/store/data.js +0 -86
  161. package/core/src/store/index.d.ts +0 -2
  162. package/core/src/store/index.js +0 -2
  163. package/core/src/utils/assignment.d.ts +0 -3
  164. package/core/src/utils/assignment.js +0 -69
  165. package/static/echartsDefaultData.js +0 -239
  166. package/static/echartsStore.js +0 -14
  167. package/static/index.js +0 -2
  168. package/style/index.css +0 -13
@@ -1,97 +0,0 @@
1
- // 绘制柱子切面
2
- export function drawGraphicShape(appearance) {
3
- const offsetX = appearance.offsetX;
4
- const offsetY = appearance.offsetY;
5
- // 绘制左侧面
6
- const CubeLeft = echarts.graphic.extendShape({
7
- shape: {
8
- x: 0,
9
- y: 0,
10
- },
11
- buildPath: function (ctx, shape) {
12
- // 会canvas的应该都能看得懂,shape是从custom传入的
13
- const xAxisPoint = shape.xAxisPoint;
14
- // console.log(shape);
15
- const c0 = [shape.x, shape.y];
16
- const c1 = [shape.x - offsetX, shape.y - offsetY];
17
- const c2 = [xAxisPoint[0] - offsetX, xAxisPoint[1] - offsetY];
18
- const c3 = [xAxisPoint[0], xAxisPoint[1]];
19
- ctx.moveTo(c0[0], c0[1]).lineTo(c1[0], c1[1]).lineTo(c2[0], c2[1]).lineTo(c3[0], c3[1]).closePath();
20
- },
21
- });
22
- // 绘制右侧面
23
- const CubeRight = echarts.graphic.extendShape({
24
- shape: {
25
- x: 0,
26
- y: 0,
27
- },
28
- buildPath: function (ctx, shape) {
29
- const xAxisPoint = shape.xAxisPoint;
30
- const c1 = [shape.x, shape.y];
31
- const c2 = [xAxisPoint[0], xAxisPoint[1]];
32
- const c3 = [xAxisPoint[0] + offsetX, xAxisPoint[1] - offsetY];
33
- const c4 = [shape.x + offsetX, shape.y - offsetY];
34
- ctx.moveTo(c1[0], c1[1]).lineTo(c2[0], c2[1]).lineTo(c3[0], c3[1]).lineTo(c4[0], c4[1]).closePath();
35
- },
36
- });
37
- // 绘制顶面
38
- const CubeTop = echarts.graphic.extendShape({
39
- shape: {
40
- x: 0,
41
- y: 0,
42
- },
43
- buildPath: function (ctx, shape) {
44
- const c1 = [shape.x, shape.y];
45
- const c2 = [shape.x + offsetX, shape.y - offsetY]; //右点
46
- const c3 = [shape.x, shape.y - offsetX];
47
- const c4 = [shape.x - offsetX, shape.y - offsetY];
48
- ctx.moveTo(c1[0], c1[1]).lineTo(c2[0], c2[1]).lineTo(c3[0], c3[1]).lineTo(c4[0], c4[1]).closePath();
49
- },
50
- });
51
- return {
52
- CubeLeft,
53
- CubeRight,
54
- CubeTop
55
- }
56
- }
57
- // 线性渐变
58
- export function graphicLinearGradient(nr, nb, nl, nt, colors) {
59
- return new echarts.graphic.LinearGradient(nr, nb, nl, nt, colors);
60
- }
61
- export function setSeriesRenderGroup(appearance, api) {
62
- const seriesRenderData = [];
63
- const groupTypeData = ['CubeLeft', 'CubeRight', 'CubeTop'];
64
- const location = api.coord([api.value(0), api.value(1)]);
65
- for (let i = 0; i < groupTypeData.length; i++) {
66
- const groupItem = groupTypeData[i];
67
- const groupNode = {
68
- type: groupItem,
69
- shape: {
70
- api,
71
- xValue: api.value(0),
72
- yValue: api.value(1),
73
- x: location[0],
74
- y: location[1],
75
- xAxisPoint: api.coord([api.value(0), 0]),
76
- }
77
- };
78
- if(i === groupTypeData.length - 1){
79
- // 顶部切面颜色填充
80
- groupNode.style = {
81
- fill: appearance.seriesCubeTopColor
82
- }
83
- }else {
84
- // 左右切面颜色填充
85
- let fillColor = graphicLinearGradient(0, 0, 0, 1, appearance[`series${groupItem}Gradient`]);
86
- const cubeColorLinear = appearance[`series${groupItem}Linear`];
87
- if(!cubeColorLinear) {
88
- fillColor = appearance[`series${groupItem}Color`];
89
- }
90
- groupNode.style = {
91
- fill: fillColor
92
- }
93
- }
94
- seriesRenderData.push(groupNode);
95
- }
96
- return seriesRenderData;
97
- }
@@ -1,3 +0,0 @@
1
- export * from './conversion';
2
- export * from './drawGraphic';
3
- export * from './changeOptions';
@@ -1,3 +0,0 @@
1
- export * from './conversion';
2
- export * from './drawGraphic';
3
- export * from './changeOptions';
@@ -1,4 +0,0 @@
1
- export * from './circle';
2
- export * from './diamond';
3
- export * from './line';
4
- export * from './triangle';
@@ -1,5 +0,0 @@
1
- export * from './circle';
2
- export * from './diamond';
3
- export * from './line';
4
- export * from './triangle';
5
- //# sourceMappingURL=index.js.map
@@ -1,4 +0,0 @@
1
- export * from './curve';
2
- export * from './line';
3
- export * from './mind';
4
- export * from './polyline';
@@ -1,5 +0,0 @@
1
- export * from './curve';
2
- export * from './line';
3
- export * from './mind';
4
- export * from './polyline';
5
- //# sourceMappingURL=index.js.map
@@ -1,2 +0,0 @@
1
- import { Node } from '../../models';
2
- export declare function iframePrimeval(ctx: CanvasRenderingContext2D, node: Node): void;
@@ -1,12 +0,0 @@
1
- import {rectangle} from 'dcim-topology2d/core'
2
-
3
- export function iframePrimeval(ctx, node) {
4
- //console.log('iframePrimeval############', node)
5
- // 绘制一个底图,类似于占位符。
6
- rectangle(ctx, node);
7
- if (!node.elementLoaded) {
8
- // 添加当前节点到div层
9
- node.addToDiv('init')
10
- node.elementRendered = false
11
- }
12
- }
@@ -1,46 +0,0 @@
1
- export * from './arbitrarygraph';
2
- export * from './arbitrarygraph.anchor';
3
- export * from './arrow';
4
- export * from './arrow.rect';
5
- export * from './arrow.anchor';
6
- export * from './circle';
7
- export * from './circle.rect';
8
- export * from './circle.anchor';
9
- export * from './cloud';
10
- export * from './cloud.rect';
11
- export * from './cloud.anchor';
12
- export * from './cube';
13
- export * from './cube.rect';
14
- export * from './cube.anchor';
15
- export * from './cube.model';
16
- export * from './diamond';
17
- export * from './diamond.rect';
18
- export * from './file';
19
- export * from './formtable';
20
- export * from './hexagon';
21
- export * from './hexagon.anchor';
22
- export * from './hexagon.rect';
23
- export * from './image.rect';
24
- export * from './image.anchor';
25
- export * from './iframe';
26
- export * from './line';
27
- export * from './line.anchor';
28
- export * from './line.rect';
29
- export * from './message';
30
- export * from './message.anchor';
31
- export * from './message.rect';
32
- export * from './pentagon';
33
- export * from './pentagon.anchor';
34
- export * from './pentagon.rect';
35
- export * from './pentagram';
36
- export * from './pentagram.anchor';
37
- export * from './pentagram.rect';
38
- export * from './people';
39
- export * from './people.rect';
40
- export * from './rectangle';
41
- export * from './rectangle.rect';
42
- export * from './tablePagination';
43
- export * from './text';
44
- export * from './triangle';
45
- export * from './triangle.anchor';
46
- export * from './triangle.rect';
@@ -1,47 +0,0 @@
1
- export * from './arbitrarygraph';
2
- export * from './arbitrarygraph.anchor';
3
- export * from './arrow';
4
- export * from './arrow.rect';
5
- export * from './arrow.anchor';
6
- export * from './circle';
7
- export * from './circle.rect';
8
- export * from './circle.anchor';
9
- export * from './cloud';
10
- export * from './cloud.rect';
11
- export * from './cloud.anchor';
12
- export * from './cube';
13
- export * from './cube.rect';
14
- export * from './cube.anchor';
15
- export * from './cube.model';
16
- export * from './diamond';
17
- export * from './diamond.rect';
18
- export * from './file';
19
- export * from './formtable';
20
- export * from './hexagon';
21
- export * from './hexagon.anchor';
22
- export * from './hexagon.rect';
23
- export * from './image.rect';
24
- export * from './image.anchor';
25
- export * from './iframe';
26
- export * from './line';
27
- export * from './line.anchor';
28
- export * from './line.rect';
29
- export * from './message';
30
- export * from './message.anchor';
31
- export * from './message.rect';
32
- export * from './pentagon';
33
- export * from './pentagon.anchor';
34
- export * from './pentagon.rect';
35
- export * from './pentagram';
36
- export * from './pentagram.anchor';
37
- export * from './pentagram.rect';
38
- export * from './people';
39
- export * from './people.rect';
40
- export * from './rectangle';
41
- export * from './rectangle.rect';
42
- export * from './tablePagination';
43
- export * from './text';
44
- export * from './triangle';
45
- export * from './triangle.anchor';
46
- export * from './triangle.rect';
47
- //# sourceMappingURL=index.js.map
@@ -1,9 +0,0 @@
1
- import { Pen } from '../models';
2
- // @ts-ignore
3
- export const commonStore: {
4
- canvasDraws: {
5
- [key: string]: (ctx: CanvasRenderingContext2D, pen: Pen) => void;
6
- };
7
- anchors: { [key: string]: (pen: Pen) => void };
8
- htmlElements: { [key: string]: HTMLDivElement }; // html元素
9
- };
@@ -1,5 +0,0 @@
1
- export var commonStore = {
2
- canvasDraws: {},
3
- anchors: {},
4
- htmlElements: {}
5
- };
@@ -1,129 +0,0 @@
1
- // @ts-ignore
2
- import { default as mitt, Emitter } from 'mitt';
3
- import { Pen, Lock } from '../models';
4
- import {Options, DefalutOptions} from '../options';
5
- import {s8} from '../utils';
6
- import { commonStore } from './common'
7
- // 2D可视化的data数据
8
- export interface visualization2DData {
9
- pens: Pen[];
10
- lineName: string;
11
- fromArrowType: string;
12
- toArrowType: string;
13
- scale: number;
14
- locked: Lock;
15
- bkImage: string;
16
- bkColor: string;
17
- grid?: boolean;
18
- websocket?: string;
19
- mqttUrl?: string;
20
- mqttOptions?: {
21
- clientId?: string;
22
- username?: string;
23
- password?: string;
24
- };
25
- mqttTopics?: string;
26
- manualCps?: boolean;
27
- dataConstruct?: any;
28
- data?: any;
29
- bkImageRect?: any;
30
- }
31
- // 2D可视化使用到的数据仓库
32
- export interface visualization2DStore {
33
- id: string;
34
- data: visualization2DData;
35
- pens: { [key: string]: Pen };
36
- options: Options;
37
- cacheDatas?: {
38
- data: visualization2DData;
39
- }[];
40
- emitter: Emitter;
41
- dpiRatio?: number;
42
- lastScale?: number; //记录上次模版的scale
43
- ratioCord: {
44
- ratio?: number;
45
- scaleX?: number;
46
- scaleY?: number;
47
- },
48
- parentElem: HTMLElement
49
- }
50
- export interface mqttData {
51
- data: null
52
- }
53
- export const syncMqttData: mqttData;
54
- // @ts-ignore
55
- export const createStore = () => {
56
- return {
57
- id: '',
58
- data: {
59
- pens: [],
60
- lineName: 'curve',
61
- fromArrowType: '',
62
- toArrowType: 'triangleSolid',
63
- scale: 1,
64
- locked: Lock.None,
65
- bkImageRect: null,
66
- mqttOptions: {
67
- clientId: s8()
68
- },
69
- dataConstruct: {}
70
- },
71
- pens: {},
72
- options: { ...DefalutOptions },
73
- emitter: mitt(),
74
- cacheDatas: [],
75
- dpiRatio: 1,
76
- lastScale: 1,
77
- ratioCord: {
78
- ratio: 1,
79
- scaleX: 1,
80
- scaleY: 1
81
- },
82
- parentElem: null
83
- } as visualization2DStore;
84
- };
85
- // @ts-ignore
86
- export const useStore = (id = 'default'): visualization2DStore => {
87
- if (!commonStore[id]) {
88
- // @ts-ignore
89
- commonStore[id] = createStore();
90
- commonStore[id].id = id;
91
- }
92
- return commonStore[id];
93
- };
94
-
95
- // @ts-ignore
96
- export const clearStore = (store: visualization2DStore) => {
97
- store.data = {
98
- bkColor: '',
99
- bkImage: '',
100
- data: undefined,
101
- grid: false,
102
- manualCps: false,
103
- mqttTopics: '',
104
- mqttUrl: '',
105
- websocket: '',
106
- pens: [],
107
- lineName: 'curve',
108
- fromArrowType: '',
109
- toArrowType: 'triangleSolid',
110
- scale: 1,
111
- locked: Lock.None,
112
- bkImageRect: null,
113
- mqttOptions: {
114
- clientId: s8()
115
- },
116
- dataConstruct: {}
117
- };
118
- store.lastScale = store.data.scale;
119
- store.pens = {};
120
- store.options = {};
121
- store.cacheDatas = [];
122
- store.dpiRatio = 1;
123
- store.lastScale = 1;
124
- store.ratioCord = {
125
- ratio: 1,
126
- scaleX: 1,
127
- scaleY: 1
128
- }
129
- };
@@ -1,86 +0,0 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- import { default as mitt } from 'mitt';
13
- import { Lock } from '../models';
14
- import {DefalutOptions} from '../options';
15
- import {s8} from '../utils';
16
- import { commonStore } from './common'
17
- export const syncMqttData = {
18
- data: null
19
- }
20
- export var createStore = function () {
21
- return {
22
- id: '',
23
- data: {
24
- pens: [],
25
- lineName: 'curve',
26
- fromArrowType: '',
27
- toArrowType: 'triangleSolid',
28
- scale: 1,
29
- locked: Lock.None,
30
- dataResize: 1, // 数据是否加载,1是,0否
31
- bkImageRect: null,
32
- mqttOptions: {
33
- clientId: s8()
34
- },
35
- dataConstruct: {}
36
- },
37
- pens: {},
38
- options: { ...DefalutOptions },
39
- emitter: mitt(),
40
- cacheDatas: [],
41
- dpiRatio: 1,
42
- lastScale: 1,
43
- ratioCord: {
44
- ratio: 1,
45
- scaleX: 1,
46
- scaleY: 1
47
- },
48
- parentElem: null
49
- };
50
- };
51
- export var useStore = function (id) {
52
- if (id === void 0) { id = 'default'; }
53
- if (!commonStore[id]) {
54
- commonStore[id] = createStore();
55
- commonStore[id].id = id;
56
- }
57
- return commonStore[id];
58
- };
59
- export var clearStore = function (store, del) {
60
- store.lastScale = store.data.scale;
61
- store.data = {
62
- pens: [],
63
- lineName: 'curve',
64
- fromArrowType: '',
65
- toArrowType: 'triangleSolid',
66
- scale: 1,
67
- locked: Lock.None,
68
- dataResize: 1, // 数据是否加载,1是,0否
69
- bkImageRect: null,
70
- mqttOptions: {
71
- clientId: s8()
72
- },
73
- dataConstruct: {}
74
- };
75
- store.pens = {};
76
- store.cacheDatas = [];
77
- store.dpiRatio = 1;
78
- store.lastScale = 1;
79
- store.ratioCord = {
80
- ratio: 1,
81
- scaleX: 1,
82
- scaleY: 1
83
- };
84
- syncMqttData.data = null;
85
- if(del) delete commonStore[store.id];
86
- };
@@ -1,2 +0,0 @@
1
- export * from './data'
2
- export * from './common'
@@ -1,2 +0,0 @@
1
- export * from './data'
2
- export * from './common'
@@ -1,3 +0,0 @@
1
- export declare function setInitNodeDataValidat(node: any): void;
2
- export declare function setDefaultColorValidat(node: any, TID: string): void;
3
- export declare function setDefaultNodeValidat(node: any, retData: any): any;
@@ -1,69 +0,0 @@
1
- // 变量赋值操作
2
- import {syncMqttData} from '../store';
3
- import { setConfItemNode } from '../healps';
4
- import { EventAction } from '../models';
5
- export function setInitNodeDataValidat(node, TID) {
6
- const syncData = syncMqttData.data;
7
- if (node.children && node.children.length) {
8
- node.children.map((_item) => {
9
- node.TID = TID;
10
- setDefaultColorValidat(node);
11
- setDefaultNodeValidat(node, syncData);
12
- })
13
- }else {
14
- node.TID = TID;
15
- setDefaultColorValidat(node);
16
- setDefaultNodeValidat(node, syncData);
17
- }
18
- }
19
- export function setDefaultColorValidat(node) {
20
- node.defaultFillStyle = node.fillStyle;
21
- node.defaultFontColor = node.font.color;
22
- if (node.name === 'line') {
23
- node.defaultStrokeStyle = node.font.color;
24
- }
25
- }
26
- export function setDefaultNodeValidat(node, retData) {
27
- //const item = JSON.parse(JSON.stringify(node));
28
- if (!node.data || !retData) return;
29
- //const node = detailData.length > 0 ? detailData : syncData
30
- const functionData = node.events.filter((ev) => {
31
- return ev.action === EventAction.Function
32
- })
33
- const dataValue = functionData[0]
34
- if (functionData.length > 0 && dataValue.value && retData) {
35
- node.data.map((d) => {
36
- const {kpiData, tagData} = retData;
37
- const key = d.key;
38
- const value = d.value;
39
- const _syncItem = key === 'tagId' ? tagData[value] : kpiData[value];
40
- if ((key === 'tagId' || key === 'kpiAddr') && _syncItem) {
41
- const isControl = parseInt(_syncItem.isControlDis); // 是否可控,0可控,1不可控
42
- if (!isControl) {
43
- d.tagVal = value
44
- d.controlParams = _syncItem
45
- // delete _syncItem[value]
46
- // Object.assign(d, _syncItem)
47
- }
48
- }
49
- })
50
- // console.log('定制函数=====')
51
- try {
52
- const func = new Function('pen', 'params', dataValue.value)
53
- func(node, JSON.stringify(retData))
54
- }catch (e) {
55
- console.log(`自定义函数 ${node.id} 出错>>>`, e);
56
- }
57
- } else {
58
- // console.log('默认函数')
59
- setConfItemNode(node, retData);
60
- }
61
- if (node.animateFrames && node.animateFrames.length) {
62
- for (var _a = 0, _af = node.animateFrames; _a < _af.length; _a++) {
63
- var ani = _af[_a];
64
- ani.state.strokeStyle = node.strokeStyle;
65
- ani.state.fillStyle = node.fillStyle;
66
- }
67
- }
68
- //return node;
69
- }