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.
- package/activity-diagram/src/final/final.d.ts +1 -1
- package/activity-diagram/src/final/final.rect.d.ts +1 -1
- package/activity-diagram/src/final/final.rect.js +1 -1
- package/activity-diagram/src/fork/fork.anchor.d.ts +1 -1
- package/activity-diagram/src/fork/fork.anchor.js +1 -1
- package/activity-diagram/src/fork/fork.d.ts +1 -1
- package/activity-diagram/src/fork/fork.rect.d.ts +1 -1
- package/activity-diagram/src/fork/fork.rect.js +1 -1
- package/activity-diagram/src/register.js +1 -1
- package/activity-diagram/src/swimlaneH/swimlaneH.d.ts +1 -1
- package/activity-diagram/src/swimlaneH/swimlaneH.rect.d.ts +1 -1
- package/activity-diagram/src/swimlaneH/swimlaneH.rect.js +1 -1
- package/activity-diagram/src/swimlaneV/swimlaneV.d.ts +1 -1
- package/activity-diagram/src/swimlaneV/swimlaneV.rect.d.ts +1 -1
- package/activity-diagram/src/swimlaneV/swimlaneV.rect.js +1 -1
- package/chart-diagram/index.d.ts +1 -3
- package/chart-diagram/index.js +1 -2
- package/chart-diagram/src/echarts/index.d.ts +2 -1
- package/chart-diagram/src/echarts/index.js +78 -86
- package/chart-diagram/src/register.js +8 -9
- package/class-diagram/src/class/class.d.ts +1 -1
- package/class-diagram/src/class/class.rect.d.ts +1 -1
- package/class-diagram/src/class/class.rect.js +1 -1
- package/class-diagram/src/register.js +1 -1
- package/core/index.d.ts +0 -2
- package/core/index.js +18 -2
- package/core/src/activeLayer.d.ts +10 -2
- package/core/src/activeLayer.js +62 -57
- package/core/src/animateLayer.d.ts +7 -3
- package/core/src/animateLayer.js +12 -10
- package/core/src/calling.d.ts +4 -1
- package/core/src/calling.js +68 -69
- package/core/src/canvas.d.ts +6 -1
- package/core/src/canvas.js +21 -22
- package/core/src/common.d.ts +7 -7
- package/core/src/common.js +698 -397
- package/core/src/core.d.ts +4 -5
- package/core/src/core.js +385 -536
- package/core/src/divLayer.d.ts +36 -2
- package/core/src/divLayer.js +305 -33
- package/core/src/healps/changeData.d.ts +2 -1
- package/core/src/healps/changeData.js +100 -89
- package/core/src/hoverLayer.d.ts +9 -2
- package/core/src/hoverLayer.js +34 -31
- package/core/src/middles/default.d.ts +3 -1
- package/core/src/middles/default.js +51 -65
- package/core/src/middles/index.d.ts +2 -1
- package/core/src/middles/index.js +2 -4
- package/core/src/middles/nodes/arbitrarygraph.js +9 -11
- package/core/src/middles/nodes/pentagon.rect.js +1 -1
- package/core/src/middles/nodes/rectangle.js +15 -54
- package/core/src/middles/nodes/rectangle.rect.js +1 -1
- package/core/src/models/data.d.ts +26 -0
- package/core/src/models/data.js +77 -0
- package/core/src/models/data.js.map +1 -0
- package/core/src/models/index.d.ts +1 -0
- package/core/src/models/index.js +1 -0
- package/core/src/models/line.js +7 -7
- package/core/src/models/node.d.ts +0 -10
- package/core/src/models/node.js +101 -155
- package/core/src/models/pen.js +68 -37
- package/core/src/models/rect.js +2 -2
- package/core/src/mqtt.d.ts +14 -0
- package/core/src/mqtt.js +82 -0
- package/core/src/mqtt.js.map +1 -0
- package/core/src/offscreen.d.ts +4 -1
- package/core/src/offscreen.js +24 -26
- package/core/src/options.d.ts +1 -3
- package/core/src/options.js +0 -2
- package/core/src/poll.js +39 -0
- package/core/src/preview.d.ts +13 -2
- package/core/src/preview.js +54 -181
- package/core/src/renderLayer.d.ts +9 -11
- package/core/src/renderLayer.js +61 -60
- package/core/src/socket.d.ts +10 -0
- package/core/src/socket.js +51 -0
- package/core/src/socket.js.map +1 -0
- package/core/src/utils/canvas.js +1 -1
- package/core/src/utils/construction.d.ts +3 -36
- package/core/src/utils/construction.js +1 -29
- package/core/src/utils/conversion.d.ts +0 -15
- package/core/src/utils/conversion.js +0 -319
- package/core/src/utils/dom.d.ts +8 -0
- package/core/src/utils/dom.js +67 -0
- package/core/src/utils/dom.js.map +1 -0
- package/core/src/utils/index.d.ts +1 -2
- package/core/src/utils/index.js +1 -2
- package/core/src/utils/onmousevent.d.ts +0 -3
- package/core/src/utils/onmousevent.js +10 -42
- package/flow-diagram/src/comment/comment.anchor.d.ts +1 -1
- package/flow-diagram/src/comment/comment.anchor.js +1 -1
- package/flow-diagram/src/comment/comment.d.ts +1 -1
- package/flow-diagram/src/data/data.anchor.d.ts +1 -1
- package/flow-diagram/src/data/data.anchor.js +1 -1
- package/flow-diagram/src/data/data.d.ts +1 -1
- package/flow-diagram/src/data/data.rect.d.ts +1 -1
- package/flow-diagram/src/data/data.rect.js +1 -1
- package/flow-diagram/src/db/db.d.ts +1 -1
- package/flow-diagram/src/db/db.rect.d.ts +1 -1
- package/flow-diagram/src/db/db.rect.js +1 -1
- package/flow-diagram/src/display/display.anchor.d.ts +1 -1
- package/flow-diagram/src/display/display.anchor.js +1 -1
- package/flow-diagram/src/display/display.d.ts +1 -1
- package/flow-diagram/src/display/display.rect.d.ts +1 -1
- package/flow-diagram/src/display/display.rect.js +1 -1
- package/flow-diagram/src/document/document.anchor.d.ts +1 -1
- package/flow-diagram/src/document/document.anchor.js +1 -1
- package/flow-diagram/src/document/document.d.ts +1 -1
- package/flow-diagram/src/document/document.rect.d.ts +1 -1
- package/flow-diagram/src/document/document.rect.js +1 -1
- package/flow-diagram/src/externStorage/externStorage.anchor.d.ts +1 -1
- package/flow-diagram/src/externStorage/externStorage.anchor.js +1 -1
- package/flow-diagram/src/externStorage/externStorage.d.ts +1 -1
- package/flow-diagram/src/externStorage/externStorage.rect.d.ts +1 -1
- package/flow-diagram/src/externStorage/externStorage.rect.js +1 -1
- package/flow-diagram/src/internalStorage/internalStorage.d.ts +1 -1
- package/flow-diagram/src/internalStorage/internalStorage.rect.d.ts +1 -1
- package/flow-diagram/src/internalStorage/internalStorage.rect.js +1 -1
- package/flow-diagram/src/manually/manually.anchor.d.ts +1 -1
- package/flow-diagram/src/manually/manually.anchor.js +1 -1
- package/flow-diagram/src/manually/manually.d.ts +1 -1
- package/flow-diagram/src/manually/manually.rect.d.ts +1 -1
- package/flow-diagram/src/manually/manually.rect.js +1 -1
- package/flow-diagram/src/parallel/parallel.anchor.d.ts +1 -1
- package/flow-diagram/src/parallel/parallel.anchor.js +1 -1
- package/flow-diagram/src/parallel/parallel.d.ts +1 -1
- package/flow-diagram/src/queue/queue.d.ts +1 -1
- package/flow-diagram/src/queue/queue.rect.d.ts +1 -1
- package/flow-diagram/src/queue/queue.rect.js +1 -1
- package/flow-diagram/src/register.js +1 -1
- package/flow-diagram/src/subprocess/subprocess.d.ts +1 -1
- package/flow-diagram/src/subprocess/subprocess.rect.d.ts +1 -1
- package/flow-diagram/src/subprocess/subprocess.rect.js +1 -1
- package/layout/src/align.d.ts +1 -1
- package/layout/src/align.js +1 -1
- package/layout/src/layout.d.ts +1 -1
- package/layout/src/layout.js +1 -1
- package/myShape-diagram/{index.js → myShape.js} +1 -4
- package/package.json +1 -1
- package/sequence-diagram/src/focus/focus.anchor.d.ts +1 -1
- package/sequence-diagram/src/focus/focus.anchor.js +1 -1
- package/sequence-diagram/src/focus/focus.d.ts +1 -1
- package/sequence-diagram/src/focus/focus.rect.d.ts +1 -1
- package/sequence-diagram/src/focus/focus.rect.js +1 -1
- package/sequence-diagram/src/lifeline/lifeline.anchor.d.ts +1 -1
- package/sequence-diagram/src/lifeline/lifeline.anchor.js +1 -1
- package/sequence-diagram/src/lifeline/lifeline.d.ts +1 -1
- package/sequence-diagram/src/lifeline/lifeline.rect.d.ts +1 -1
- package/sequence-diagram/src/lifeline/lifeline.rect.js +1 -1
- package/sequence-diagram/src/register.js +1 -1
- package/chart-diagram/src/utils/changeOptions.d.ts +0 -8
- package/chart-diagram/src/utils/changeOptions.js +0 -273
- package/chart-diagram/src/utils/conversion.d.ts +0 -19
- package/chart-diagram/src/utils/conversion.js +0 -601
- package/chart-diagram/src/utils/drawGraphic.d.ts +0 -3
- package/chart-diagram/src/utils/drawGraphic.js +0 -97
- package/chart-diagram/src/utils/formatter.d.ts +0 -1
- package/chart-diagram/src/utils/formatter.js +0 -206
- package/chart-diagram/src/utils/index.d.ts +0 -5
- package/chart-diagram/src/utils/index.js +0 -5
- package/chart-diagram/src/utils/render.d.ts +0 -8
- package/chart-diagram/src/utils/render.js +0 -223
- package/chart-diagram/src/utils/surfaceParametricConversion.d.ts +0 -3
- package/chart-diagram/src/utils/surfaceParametricConversion.js +0 -252
- package/core/src/element/common.d.ts +0 -6
- package/core/src/element/common.js +0 -62
- package/core/src/element/datePicker.d.ts +0 -3
- package/core/src/element/datePicker.js +0 -44
- package/core/src/element/iframe.d.ts +0 -3
- package/core/src/element/iframe.js +0 -12
- package/core/src/element/index.d.ts +0 -5
- package/core/src/element/index.js +0 -6
- package/core/src/element/select.d.ts +0 -11
- package/core/src/element/select.js +0 -273
- package/core/src/element/tab.d.ts +0 -1
- package/core/src/element/tab.js +0 -20
- package/core/src/element/time.d.ts +0 -3
- package/core/src/element/time.js +0 -44
- package/core/src/middles/arrows/index.d.ts +0 -4
- package/core/src/middles/arrows/index.js +0 -5
- package/core/src/middles/lines/index.d.ts +0 -4
- package/core/src/middles/lines/index.js +0 -5
- package/core/src/middles/nodes/formDatePicker.d.ts +0 -2
- package/core/src/middles/nodes/formDatePicker.js +0 -108
- package/core/src/middles/nodes/formoverflow.js +0 -62
- package/core/src/middles/nodes/formselect.d.ts +0 -2
- package/core/src/middles/nodes/formselect.js +0 -111
- package/core/src/middles/nodes/iframe.d.ts +0 -2
- package/core/src/middles/nodes/iframe.js +0 -29
- package/core/src/middles/nodes/index.d.ts +0 -52
- package/core/src/middles/nodes/index.js +0 -54
- package/core/src/middles/nodes/progress.d.ts +0 -2
- package/core/src/middles/nodes/progress.js +0 -63
- package/core/src/middles/nodes/progress.js.map +0 -1
- package/core/src/middles/nodes/switchs.d.ts +0 -2
- package/core/src/middles/nodes/switchs.js +0 -46
- package/core/src/middles/nodes/time.d.ts +0 -2
- package/core/src/middles/nodes/time.js +0 -98
- package/core/src/store/common.d.ts +0 -9
- package/core/src/store/common.js +0 -5
- package/core/src/store/data.d.ts +0 -205
- package/core/src/store/data.js +0 -198
- package/core/src/store/index.d.ts +0 -2
- package/core/src/store/index.js +0 -2
- package/core/src/utils/assignment.d.ts +0 -7
- package/core/src/utils/assignment.js +0 -229
- package/core/src/utils/params.d.ts +0 -3
- package/core/src/utils/params.js +0 -136
- package/static/echartsDefaultData.js +0 -178
- package/static/element.js +0 -14
- package/static/form.js +0 -11
- package/static/index.js +0 -3
- package/store/actions.js +0 -2
- package/store/clear.js +0 -14
- package/store/default.js +0 -22
- package/store/index.js +0 -3
- package/style/common.css +0 -15
- package/style/datePicker.css +0 -44
- package/style/editor.css +0 -16
- package/style/index.css +0 -5
- package/style/select.css +0 -143
- /package/myShape-diagram/{index.d.ts → myShape.ts} +0 -0
package/core/src/models/pen.js
CHANGED
|
@@ -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:
|
|
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,17 +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
|
-
|
|
115
|
-
this.borderRadiusTopLeft = json.borderRadiusTopLeft || 0;
|
|
116
|
-
this.borderRadiusTopRight = json.borderRadiusTopRight || 0;
|
|
117
|
-
this.borderRadiusBottomLeft = json.borderRadiusBottomLeft || 0;
|
|
118
|
-
this.borderRadiusBottomRight = json.borderRadiusBottomRight || 0;
|
|
119
|
-
|
|
120
|
-
this.focusFillStyle = json.focusFillStyle || '';
|
|
121
111
|
if (json.rectInParent) {
|
|
122
112
|
this.rectInParent = json.rectInParent;
|
|
123
113
|
}
|
|
@@ -138,7 +128,7 @@ var Pen = /** @class */ (function () {
|
|
|
138
128
|
}
|
|
139
129
|
}
|
|
140
130
|
Pen.prototype.render = function (ctx) {
|
|
141
|
-
if (!this.visible && !
|
|
131
|
+
if (!this.visible && !window.location.pathname.includes('workspace')){
|
|
142
132
|
return;
|
|
143
133
|
}
|
|
144
134
|
if (this.from && !this.to) {
|
|
@@ -157,16 +147,8 @@ var Pen = /** @class */ (function () {
|
|
|
157
147
|
if (this.lineWidth > 1) {
|
|
158
148
|
ctx.lineWidth = this.lineWidth;
|
|
159
149
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
} else {
|
|
163
|
-
const staticStrokeStyle = this.strokeStyle || '#222';
|
|
164
|
-
ctx.strokeStyle = !this.activeImgeIndex ? this.visitStrokeStyle || staticStrokeStyle : this.defaultStrokeStyle || staticStrokeStyle;
|
|
165
|
-
}
|
|
166
|
-
//ctx.strokeStyle = this.dash === 4 ? 'transparent' : this.strokeStyle || '#222';
|
|
167
|
-
//背景聚焦色
|
|
168
|
-
this.focusFillStyle && !this.activeImgeIndex ? ctx.fillStyle = this.focusFillStyle : (this.fillStyle && (ctx.fillStyle = this.fillStyle));
|
|
169
|
-
|
|
150
|
+
ctx.strokeStyle = this.dash === 4 ? 'transparent' : this.strokeStyle || '#222';
|
|
151
|
+
this.fillStyle && (ctx.fillStyle = this.fillStyle);
|
|
170
152
|
if (this.lineCap) {
|
|
171
153
|
ctx.lineCap = this.lineCap;
|
|
172
154
|
}
|
|
@@ -228,19 +210,19 @@ var Pen = /** @class */ (function () {
|
|
|
228
210
|
}
|
|
229
211
|
for (var _i = 0, _a = this.events; _i < _a.length; _i++) {
|
|
230
212
|
var item = _a[_i];
|
|
231
|
-
if (item.type !== EventType.Click) {
|
|
213
|
+
if (item.type !== EventType.Click ) {
|
|
232
214
|
continue;
|
|
233
215
|
}
|
|
234
216
|
// 画布页面,单击跳转链接事件屏蔽
|
|
235
|
-
if
|
|
217
|
+
if(item.action === EventAction.Link && window.location.pathname.includes('workspace')){
|
|
236
218
|
continue
|
|
237
219
|
}
|
|
238
|
-
if
|
|
220
|
+
if(item.action === EventAction.Link){
|
|
239
221
|
this[this.eventFns[item.action]](item.value, item.dcimMenuForType);
|
|
240
|
-
}
|
|
222
|
+
}else{
|
|
241
223
|
this[this.eventFns[item.action]] && this[this.eventFns[item.action]](item.value, item.params);
|
|
242
224
|
}
|
|
243
|
-
if
|
|
225
|
+
if(item.action === 7){
|
|
244
226
|
Store.set(this.generateStoreKey('LT:hidePen'), item.value);
|
|
245
227
|
}
|
|
246
228
|
}
|
|
@@ -257,6 +239,55 @@ var Pen = /** @class */ (function () {
|
|
|
257
239
|
this[this.eventFns[item.action]] && this[this.eventFns[item.action]](item.value, item.params);
|
|
258
240
|
}
|
|
259
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
|
+
};
|
|
260
291
|
Pen.prototype.show = function () {
|
|
261
292
|
this.visible = true;
|
|
262
293
|
return this;
|
|
@@ -279,10 +310,10 @@ var Pen = /** @class */ (function () {
|
|
|
279
310
|
// window.open(url, params === undefined ? '_blank' : params);
|
|
280
311
|
var port = window.location.port;
|
|
281
312
|
var href = window.location.href;
|
|
282
|
-
if
|
|
283
|
-
url
|
|
313
|
+
if(!url.includes("http") && port.includes("3000") && url.includes("id")){
|
|
314
|
+
url= '/workspace?id=' + url.split('id=')[1]
|
|
284
315
|
// console.log('url:3000===',url)
|
|
285
|
-
}
|
|
316
|
+
}else if(!url.includes("http://") && href.includes("topologyDetail")){
|
|
286
317
|
switch (params) {
|
|
287
318
|
case '1': // 返回上一页
|
|
288
319
|
let str = href.replace(/\/topologyDetail/g, "")
|
package/core/src/models/rect.js
CHANGED
|
@@ -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
|
+
}
|
package/core/src/mqtt.js
ADDED
|
@@ -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"}
|
package/core/src/offscreen.d.ts
CHANGED
|
@@ -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;
|
package/core/src/offscreen.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var __extends = (this && this.__extends) || (function () {
|
|
2
2
|
var extendStatics = function (d, b) {
|
|
3
3
|
extendStatics = Object.setPrototypeOf ||
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
6
6
|
return extendStatics(d, b);
|
|
7
7
|
};
|
|
8
8
|
return function (d, b) {
|
|
@@ -13,55 +13,53 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
13
13
|
})();
|
|
14
14
|
import { Store } from 'le5le-store';
|
|
15
15
|
import { Canvas } from './canvas';
|
|
16
|
-
import { Node, Line } from './models'
|
|
17
|
-
import { commonStore } from './store'
|
|
18
16
|
var Offscreen = /** @class */ (function (_super) {
|
|
19
17
|
__extends(Offscreen, _super);
|
|
20
|
-
function Offscreen(TID) {
|
|
21
|
-
|
|
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;
|
|
25
26
|
Store.set(_this.generateStoreKey('LT:offscreen'), _this.canvas);
|
|
26
27
|
return _this;
|
|
27
28
|
}
|
|
28
|
-
Offscreen.prototype.getRoutineLayer = function
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
29
|
+
Offscreen.prototype.getRoutineLayer = function(auto) {
|
|
30
|
+
if(!auto || auto.includes('ActiveLayer')) {
|
|
31
|
+
this.activeLayer = Store.get(this.generateStoreKey('LT:ActiveLayer'));
|
|
32
|
+
}
|
|
33
|
+
if(!auto || auto.includes('HoverLayer')) {
|
|
34
|
+
this.hoverLayer = Store.get(this.generateStoreKey('LT:HoverLayer'));
|
|
35
|
+
}
|
|
36
|
+
if(!auto || auto.includes('AnimateLayer')) {
|
|
37
|
+
this.animateLayer = Store.get(this.generateStoreKey('LT:AnimateLayer'));
|
|
38
|
+
}
|
|
38
39
|
};
|
|
39
40
|
Offscreen.prototype.render = function () {
|
|
40
41
|
_super.prototype.render.call(this);
|
|
41
42
|
var ctx = this.canvas.getContext('2d');
|
|
42
|
-
|
|
43
|
-
|
|
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 instanceof Line)) item = new Node(item);
|
|
48
46
|
if (!item.getTID()) {
|
|
49
47
|
item.setTID(this.TID);
|
|
50
48
|
}
|
|
51
49
|
item.render(ctx);
|
|
52
50
|
}
|
|
53
|
-
if
|
|
51
|
+
if(this.activeLayer) {
|
|
54
52
|
this.activeLayer.render(ctx);
|
|
55
53
|
}
|
|
56
|
-
if
|
|
57
|
-
|
|
54
|
+
if(this.hoverLayer) {
|
|
55
|
+
this.hoverLayer.render(ctx);
|
|
58
56
|
}
|
|
59
|
-
if
|
|
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;
|
package/core/src/options.d.ts
CHANGED
|
@@ -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
|
|
package/core/src/options.js
CHANGED
package/core/src/poll.js
ADDED
|
@@ -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
|
package/core/src/preview.d.ts
CHANGED
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
// @ts-ignore
|
|
2
|
-
import {
|
|
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);
|
|
7
|
-
private eventChangeSubcribe;
|
|
8
19
|
private scheduledAnimationFrame;
|
|
9
20
|
private onMouseMove;
|
|
10
21
|
private onmousedown;
|