dcim-topology2d 1.1.3 → 3.0.2
Sign up to get free protection for your applications and to get access to all the features.
- 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/src/echarts/index.d.ts +1 -1
- package/chart-diagram/src/echarts/index.js +7 -10
- package/chart-diagram/src/register.js +1 -1
- 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 -1
- package/core/index.js +0 -1
- package/core/src/activeLayer.d.ts +10 -2
- package/core/src/activeLayer.js +41 -42
- 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 +41 -40
- package/core/src/canvas.d.ts +6 -1
- package/core/src/canvas.js +18 -17
- package/core/src/common.d.ts +5 -5
- package/core/src/common.js +115 -161
- package/core/src/core.d.ts +4 -3
- package/core/src/core.js +253 -228
- package/core/src/divLayer.d.ts +7 -2
- package/core/src/divLayer.js +25 -25
- package/core/src/healps/changeData.d.ts +1 -1
- package/core/src/healps/changeData.js +42 -77
- package/core/src/hoverLayer.d.ts +9 -2
- package/core/src/hoverLayer.js +34 -31
- 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/node.js +12 -14
- package/core/src/models/pen.js +1 -10
- 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 +8 -10
- package/core/src/options.js +0 -1
- package/core/src/poll.js +2 -0
- package/core/src/preview.d.ts +13 -1
- package/core/src/preview.js +34 -42
- package/core/src/renderLayer.d.ts +3 -1
- package/core/src/renderLayer.js +31 -26
- 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/conversion.d.ts +0 -7
- package/core/src/utils/conversion.js +0 -54
- package/core/src/utils/dom.d.ts +5 -4
- package/core/src/utils/dom.js +1 -3
- package/core/src/utils/onmousevent.js +3 -12
- 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/myShape.js +1 -1
- 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/core/src/store/common.d.ts +0 -9
- package/core/src/store/common.js +0 -5
- package/core/src/store/data.d.ts +0 -126
- package/core/src/store/data.js +0 -80
- package/core/src/store/index.d.ts +0 -2
- package/core/src/store/index.js +0 -2
- package/static/echartsDefaultData.js +0 -95
- package/static/index.js +0 -1
- package/style/index.css +0 -10
package/core/src/common.js
CHANGED
@@ -3,14 +3,14 @@ import {DivLayer} from './divLayer';
|
|
3
3
|
import {AnimateLayer} from './animateLayer';
|
4
4
|
import {RenderLayer} from './renderLayer';
|
5
5
|
import {Offscreen} from './offscreen';
|
6
|
-
import {
|
7
|
-
import {
|
8
|
-
import {
|
9
|
-
import {
|
6
|
+
import {Socket} from './socket';
|
7
|
+
import {Line, Node, Pen, Point, TopologyData, EventAction} from './models';
|
8
|
+
import {setConfItemNode} from './healps';
|
9
|
+
import {s8, formatPadding, getRect, previewType} from './utils';
|
10
|
+
import {DefalutOptions} from './options';
|
10
11
|
import {POLL} from './poll';
|
11
12
|
import axios from 'axios';
|
12
13
|
import * as mqtt from './mqtt.min';
|
13
|
-
import {echartsDefaultDataMap, echartsLineBarDefaultLegendData} from "../../static";
|
14
14
|
|
15
15
|
var MoveInType;
|
16
16
|
(function (MoveInType) {
|
@@ -29,33 +29,28 @@ var Common = /** @class */ (function () {
|
|
29
29
|
function Common(parent, options) {
|
30
30
|
var _this = this;
|
31
31
|
_this.moveInType = MoveInType;
|
32
|
-
this.mqttDataSouse = axios.CancelToken.source();
|
33
32
|
this.mouseDown = null;
|
34
|
-
this.renderTimer = 0;
|
35
|
-
this.lastRender = 0;
|
36
|
-
this.id = s8();
|
37
|
-
this.store = useStore(this.id);
|
38
33
|
if (typeof parent === 'string') {
|
39
|
-
this.
|
34
|
+
this.parentElem = document.getElementById(parent);
|
40
35
|
} else {
|
41
|
-
this.
|
36
|
+
this.parentElem = parent;
|
42
37
|
}
|
43
38
|
if (!options) {
|
44
39
|
options = {};
|
45
40
|
}
|
46
|
-
this.
|
47
|
-
this.
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
this.
|
53
|
-
|
41
|
+
this.parentElem.style.position = 'relative';
|
42
|
+
this.parentElem.style.overflow = 'auto';
|
43
|
+
var font = Object.assign({}, DefalutOptions.font, options.font);
|
44
|
+
options.font = font;
|
45
|
+
this.options = Object.assign({}, DefalutOptions, options);
|
46
|
+
this.data = new TopologyData();
|
47
|
+
this.id = s8();
|
48
|
+
Store.set(this.generateStoreKey('topology-data'), this.data);
|
54
49
|
var id = this.id;
|
55
|
-
this.animateLayer = new AnimateLayer(id);
|
56
|
-
this.offscreen = new Offscreen(id);
|
57
|
-
this.canvas = new RenderLayer(id);
|
58
|
-
this.divLayer = new DivLayer(id);
|
50
|
+
this.animateLayer = new AnimateLayer(this.options, id);
|
51
|
+
this.offscreen = new Offscreen(this.parentElem, this.options, id);
|
52
|
+
this.canvas = new RenderLayer(this.parentElem, this.options, id);
|
53
|
+
this.divLayer = new DivLayer(this.parentElem, this.options, id);
|
59
54
|
this.divLayer.canvas.tabIndex = 0;
|
60
55
|
this.divLayer.canvas.ondblclick = this.ondblclick;
|
61
56
|
this.divLayer.canvas.onblur = function () {
|
@@ -114,6 +109,7 @@ var Common = /** @class */ (function () {
|
|
114
109
|
};
|
115
110
|
this.openCount = 0;
|
116
111
|
this.timmerByTopology = null;
|
112
|
+
this.ratioCord = null;
|
117
113
|
this.lastTranlated = {x: 0, y: 0};
|
118
114
|
this.moveIn = {
|
119
115
|
type: 'None',
|
@@ -140,6 +136,7 @@ var Common = /** @class */ (function () {
|
|
140
136
|
this.tip = '';
|
141
137
|
this.rendering = false;
|
142
138
|
this.isFullScreen = false;
|
139
|
+
this.socket = null;
|
143
140
|
this.inputObj = null;
|
144
141
|
this.input = document.createElement('textarea');
|
145
142
|
this.input.style.position = 'absolute';
|
@@ -150,11 +147,11 @@ var Common = /** @class */ (function () {
|
|
150
147
|
this.input.style.outline = 'none';
|
151
148
|
this.input.style.border = '1px solid #cdcdcd';
|
152
149
|
this.input.style.resize = 'none';
|
153
|
-
this.
|
150
|
+
this.parentElem.appendChild(this.input);
|
154
151
|
this.paginationPageListBox = document.createElement('ul');
|
155
152
|
this.pagenationPageInput = document.createElement('input');
|
156
153
|
this.tablePaginationPageStyle();
|
157
|
-
this.
|
154
|
+
this.parentElem.appendChild(this.paginationPageListBox);
|
158
155
|
// 列表数据选取
|
159
156
|
this.paginationPageListNode = function (ev) {
|
160
157
|
const node = _this.moveIn.activeNode;
|
@@ -177,71 +174,59 @@ var Common = /** @class */ (function () {
|
|
177
174
|
window.topology = this;
|
178
175
|
}
|
179
176
|
|
180
|
-
Common.prototype.conversionData = function (obj
|
181
|
-
this.
|
177
|
+
Common.prototype.conversionData = function (obj) {
|
178
|
+
this.parentElem.scrollLeft = 0;
|
179
|
+
this.parentElem.scrollTop = 0;
|
180
|
+
this.canvas.clearBkImg();
|
181
|
+
this.divLayer.clear();
|
182
182
|
let data = JSON.parse(JSON.stringify(obj));
|
183
183
|
if (!data) {
|
184
184
|
data = {pens: []};
|
185
185
|
}
|
186
|
-
Object.assign(this.
|
187
|
-
this.store.data.pens = [];
|
186
|
+
Object.assign(this.data, data);
|
188
187
|
this.setBKImageRect();
|
188
|
+
this.ratioCord = {
|
189
|
+
ratio: 1,
|
190
|
+
scaleX: 1,
|
191
|
+
scaleY: 1
|
192
|
+
};
|
189
193
|
this.openCount = 0
|
194
|
+
this.data.pens = [];
|
190
195
|
// for old data.
|
191
196
|
if (data.nodes) {
|
192
197
|
for (var _i = 0, _a = data.nodes; _i < _a.length; _i++) {
|
193
|
-
|
194
|
-
this.
|
195
|
-
this.store.pens[item.id] = item;
|
198
|
+
var item = new Node(_a[_i]);
|
199
|
+
this.data.pens.push(item);
|
196
200
|
this.setSwitchTabData(item, _i);
|
197
|
-
// 初始化图表数据
|
198
|
-
if (item.name === 'echarts' && item.data && type !== 'mqtt') {
|
199
|
-
item.data.echarts.option = setStatisticalData(item, 'def');
|
200
|
-
}
|
201
201
|
}
|
202
202
|
for (var _b = 0, _c = data.lines; _b < _c.length; _b++) {
|
203
|
-
|
204
|
-
this.
|
205
|
-
this.store.pens[item.id] = item;
|
203
|
+
var item = _c[_b];
|
204
|
+
this.data.pens.push(new Line(item));
|
206
205
|
}
|
207
206
|
}
|
208
207
|
// end.
|
209
208
|
if (data.pens) {
|
210
209
|
for (var _d = 0, _e = data.pens; _d < _e.length; _d++) {
|
211
|
-
|
210
|
+
var item = _e[_d];
|
212
211
|
if (!item.from) {
|
213
|
-
|
214
|
-
this.
|
215
|
-
this.store.pens[item.id] = node;
|
212
|
+
var node = new Node(item);
|
213
|
+
this.data.pens.push(node);
|
216
214
|
this.setSwitchTabData(node, _d);
|
217
|
-
// 初始化图表数据
|
218
|
-
if (node.name === 'echarts' && node.data && type !== 'mqtt') {
|
219
|
-
node.data.echarts.option = setStatisticalData(node, 'def');
|
220
|
-
}
|
221
215
|
} else {
|
222
|
-
|
223
|
-
this.store.data.pens.push(linNode);
|
224
|
-
this.store.pens[item.id] = linNode;
|
216
|
+
this.data.pens.push(new Line(item));
|
225
217
|
}
|
226
218
|
}
|
227
219
|
}
|
228
220
|
};
|
229
|
-
Common.prototype.clear = function (del){
|
230
|
-
clearStore(this.store, del);
|
231
|
-
this.canvas.clearBkImg();
|
232
|
-
this.divLayer.clear();
|
233
|
-
this.store.parentElem.scrollLeft = 0;
|
234
|
-
this.store.parentElem.scrollTop = 0;
|
235
|
-
};
|
236
221
|
Common.prototype.setBKImageRect = function () {
|
237
|
-
if (this.
|
238
|
-
this.
|
239
|
-
this.
|
240
|
-
this.
|
241
|
-
this.
|
242
|
-
this.
|
243
|
-
x: this.
|
244
|
-
y: this.
|
222
|
+
if (this.data.bkImageRect) {
|
223
|
+
this.data.bkImageRect.x = this.data.bkImageRect.x ? Number(this.data.bkImageRect.x) : 0;
|
224
|
+
this.data.bkImageRect.y = this.data.bkImageRect.y ? Number(this.data.bkImageRect.y) : 0;
|
225
|
+
this.data.bkImageRect.width = this.data.bkImageRect.width ? Number(this.data.bkImageRect.width) : this.canvas.width;
|
226
|
+
this.data.bkImageRect.height = this.data.bkImageRect.height ? Number(this.data.bkImageRect.height) : this.canvas.height;
|
227
|
+
this.data.bkImageRect.center = {
|
228
|
+
x: this.data.bkImageRect.x + this.data.bkImageRect.width / 2,
|
229
|
+
y: this.data.bkImageRect.y + this.data.bkImageRect.height / 2
|
245
230
|
}
|
246
231
|
}
|
247
232
|
};
|
@@ -277,40 +262,20 @@ var Common = /** @class */ (function () {
|
|
277
262
|
}
|
278
263
|
};
|
279
264
|
Common.prototype.canvasResize = function (size) {
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
this.divLayer.resize(size);
|
285
|
-
}catch (err) {
|
286
|
-
//console.log('resize-----', err)
|
287
|
-
}
|
265
|
+
this.canvas.resize(size);
|
266
|
+
//this.canvas.bkImgRectResize(size);
|
267
|
+
this.offscreen.resize(size);
|
268
|
+
this.divLayer.resize(size);
|
288
269
|
};
|
289
270
|
// Render or redraw
|
290
271
|
Common.prototype.render = function (noFocus) {
|
291
|
-
|
292
|
-
|
293
|
-
const now = performance.now();
|
294
|
-
if (now - _this.lastRender < _this.store.options.interval && !noFocus) {
|
295
|
-
if (_this.renderTimer) {
|
296
|
-
cancelAnimationFrame(_this.renderTimer);
|
297
|
-
}
|
298
|
-
_this.renderTimer = requestAnimationFrame(_this.render);
|
299
|
-
|
300
|
-
return;
|
301
|
-
}
|
302
|
-
this.renderTimer = 0;
|
303
|
-
this.lastRender = now;
|
304
|
-
if (this.rendering) {
|
305
|
-
return this;
|
306
|
-
}
|
307
|
-
this.rendering = true;
|
308
|
-
this.offscreen.render();
|
309
|
-
this.canvas.render();
|
310
|
-
this.rendering = false;
|
311
|
-
}catch (e) {
|
312
|
-
//console.log(e)
|
272
|
+
if (this.rendering) {
|
273
|
+
return this;
|
313
274
|
}
|
275
|
+
this.rendering = true;
|
276
|
+
this.offscreen.render();
|
277
|
+
this.canvas.render();
|
278
|
+
this.rendering = false;
|
314
279
|
};
|
315
280
|
Common.prototype.generateStoreKey = function (key) {
|
316
281
|
return this.id + "-" + key;
|
@@ -393,7 +358,7 @@ var Common = /** @class */ (function () {
|
|
393
358
|
this.pagenationPageInput.style.left = node.paginationData.targetPageLocal.x + 'px';
|
394
359
|
this.pagenationPageInput.style.top = node.paginationData.targetPageLocal.y + 'px';
|
395
360
|
this.pagenationPageInput.style.height = node.rect.height + 'px';
|
396
|
-
this.
|
361
|
+
this.parentElem.appendChild(this.pagenationPageInput);
|
397
362
|
};
|
398
363
|
// 展开分页列表
|
399
364
|
Common.prototype.spreadPageListHandle = function (node, e) {
|
@@ -461,8 +426,8 @@ var Common = /** @class */ (function () {
|
|
461
426
|
// 如果存在按钮组节点数据
|
462
427
|
if (changeNode[node.id]) {
|
463
428
|
for (let switchNode of Object.values(changeNode)) {
|
464
|
-
if (this.
|
465
|
-
this.
|
429
|
+
if (this.data.pens[switchNode.tagOrder]) {
|
430
|
+
this.data.pens[switchNode.tagOrder].activeImgeIndex = switchNode.id !== node.id;
|
466
431
|
}
|
467
432
|
}
|
468
433
|
}
|
@@ -481,23 +446,23 @@ var Common = /** @class */ (function () {
|
|
481
446
|
Common.prototype.s8 = function () {
|
482
447
|
return s8()
|
483
448
|
};
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
449
|
+
Common.prototype.openSocket = function (url) {
|
450
|
+
this.closeSocket();
|
451
|
+
if (url || this.data.websocket) {
|
452
|
+
this.socket = new Socket(url || this.data.websocket, this.data);
|
453
|
+
}
|
454
|
+
};
|
455
|
+
Common.prototype.closeSocket = function () {
|
456
|
+
if (this.socket) {
|
457
|
+
this.socket.close();
|
458
|
+
}
|
459
|
+
};
|
495
460
|
Common.prototype.openMqtt = function (url, options) {
|
496
461
|
this.closeMqtt();
|
497
|
-
if (url || this.
|
498
|
-
url = url || this.
|
499
|
-
const mqttTopics = this.initData && this.initData.mqttTopics ? this.initData.mqttTopics : this.
|
500
|
-
options = options || this.
|
462
|
+
if (url || this.data.mqttUrl) {
|
463
|
+
url = url || this.data.mqttUrl;
|
464
|
+
const mqttTopics = this.initData && this.initData.mqttTopics ? this.initData.mqttTopics : this.data.mqttTopics;
|
465
|
+
options = options || this.data.mqttOptions
|
501
466
|
let topics = mqttTopics
|
502
467
|
this.isEnd = false;
|
503
468
|
// let num = 0; // 记录推送的次数,用于判单丢失情况
|
@@ -505,7 +470,7 @@ var Common = /** @class */ (function () {
|
|
505
470
|
var _this = this;
|
506
471
|
this.mqttClient.on('message', function (topic, message) {
|
507
472
|
//console.log('openMqtt11===================', topic, message)
|
508
|
-
if (!_this.
|
473
|
+
if (!_this.data.pens.length || !topic || topic != _this.data.mqttTopics) {
|
509
474
|
return;
|
510
475
|
}
|
511
476
|
if (!this.isEnd) {
|
@@ -519,7 +484,7 @@ var Common = /** @class */ (function () {
|
|
519
484
|
};
|
520
485
|
Common.prototype.openPoll = function (message, val) {
|
521
486
|
if (message) {
|
522
|
-
this.poll = new POLL(this.
|
487
|
+
this.poll = new POLL(this.data, message, val);
|
523
488
|
}
|
524
489
|
};
|
525
490
|
Common.prototype.clearInterValAll = function () {
|
@@ -547,10 +512,10 @@ var Common = /** @class */ (function () {
|
|
547
512
|
this.inputObj = null;
|
548
513
|
};
|
549
514
|
Common.prototype.showInput = function (item) {
|
550
|
-
if (this.
|
515
|
+
if (this.data.locked ||
|
551
516
|
item.locked ||
|
552
517
|
item.hideInput ||
|
553
|
-
this.
|
518
|
+
this.options.hideInput) {
|
554
519
|
return;
|
555
520
|
}
|
556
521
|
this.inputObj = item;
|
@@ -569,9 +534,9 @@ var Common = /** @class */ (function () {
|
|
569
534
|
this.input.focus();
|
570
535
|
};
|
571
536
|
Common.prototype.getRect = function (pens) {
|
572
|
-
if (!this.
|
537
|
+
if (!this.data) return;
|
573
538
|
if (!pens) {
|
574
|
-
pens = this.
|
539
|
+
pens = this.data.pens;
|
575
540
|
}
|
576
541
|
return getRect(pens);
|
577
542
|
};
|
@@ -589,7 +554,7 @@ var Common = /** @class */ (function () {
|
|
589
554
|
}
|
590
555
|
var offsetX = x - this.lastTranlated.x;
|
591
556
|
var offsetY = y - this.lastTranlated.y;
|
592
|
-
for (var _i = 0, _a = this.
|
557
|
+
for (var _i = 0, _a = this.data.pens; _i < _a.length; _i++) {
|
593
558
|
var item = _a[_i];
|
594
559
|
item.translate(offsetX, offsetY);
|
595
560
|
}
|
@@ -608,7 +573,7 @@ var Common = /** @class */ (function () {
|
|
608
573
|
var viewCenter = this.getViewCenter(padding);
|
609
574
|
var center = rect.center;
|
610
575
|
this.translate(viewCenter.x - center.x, viewCenter.y - center.y);
|
611
|
-
var parentElem = this.
|
576
|
+
var parentElem = this.canvas.parentElem;
|
612
577
|
var x = (parentElem.scrollWidth - parentElem.offsetWidth) / 2;
|
613
578
|
var y = (parentElem.scrollHeight - parentElem.offsetHeight) / 2;
|
614
579
|
parentElem.scrollTo(x, y);
|
@@ -619,7 +584,7 @@ var Common = /** @class */ (function () {
|
|
619
584
|
return !(rect.width === 99999 || rect.height === 99999);
|
620
585
|
};
|
621
586
|
Common.prototype.getViewCenter = function (viewPadding) {
|
622
|
-
var padding = formatPadding(viewPadding || this.
|
587
|
+
var padding = formatPadding(viewPadding || this.options.viewPadding);
|
623
588
|
var _a = this.canvas, width = _a.width, height = _a.height;
|
624
589
|
return {
|
625
590
|
x: (width - padding[1] - padding[3]) / 2 + padding[3],
|
@@ -683,7 +648,7 @@ var Common = /** @class */ (function () {
|
|
683
648
|
}
|
684
649
|
var tipMarkdownMarginLeft = count * 3 + 11
|
685
650
|
|
686
|
-
var parentRect = this.
|
651
|
+
var parentRect = this.parentElem.getBoundingClientRect();
|
687
652
|
var elemRect = elem.getBoundingClientRect();
|
688
653
|
var x = parentRect.left + dataRect.x;
|
689
654
|
var y = pos.y + parentRect.top;
|
@@ -691,8 +656,8 @@ var Common = /** @class */ (function () {
|
|
691
656
|
x = x + dataRect.width / 2 - tipMarkdownMarginLeft
|
692
657
|
y = parentRect.top + dataRect.ey - dataRect.height - 46
|
693
658
|
}
|
694
|
-
x -= this.
|
695
|
-
y -= this.
|
659
|
+
x -= this.parentElem.scrollLeft;
|
660
|
+
y -= this.parentElem.scrollTop;
|
696
661
|
if (x < 0) {
|
697
662
|
x = 0;
|
698
663
|
}
|
@@ -724,11 +689,10 @@ var Common = /** @class */ (function () {
|
|
724
689
|
this.tip = '';
|
725
690
|
};
|
726
691
|
Common.prototype.dispatch = function (event, data) {
|
727
|
-
if(
|
728
|
-
|
729
|
-
this.store.options.on(event, data);
|
692
|
+
if (this.options.on) {
|
693
|
+
this.options.on(event, data);
|
730
694
|
}
|
731
|
-
if (event === 'node' && data.name == 'tablePagination' && this.
|
695
|
+
if (event === 'node' && data.name == 'tablePagination' && this.options.type !== 'topology') {
|
732
696
|
const tableNodes = Store.get('FORM:tableData').data.tableNodes[data.paginationData.bindFromTableId];
|
733
697
|
const pageSize = data.paginationData.pageSize;
|
734
698
|
const offset = (parseInt(data.paginationData.pageNumber) - 1) * pageSize;
|
@@ -754,7 +718,7 @@ var Common = /** @class */ (function () {
|
|
754
718
|
}
|
755
719
|
this.initType = type
|
756
720
|
this.initData = data
|
757
|
-
const canvasData = data ? data : this.
|
721
|
+
const canvasData = data ? data : this.data
|
758
722
|
//this.topologyDetailData = initData
|
759
723
|
const url = canvasData.mqttUrl
|
760
724
|
// if(url && url.indexOf('://') > -1){
|
@@ -794,7 +758,7 @@ var Common = /** @class */ (function () {
|
|
794
758
|
};
|
795
759
|
Common.prototype.initTagParams = async function (eventType) {
|
796
760
|
this.clearTagParams(eventType)
|
797
|
-
const pensData = this.
|
761
|
+
const pensData = this.data.pens
|
798
762
|
let tagParams = this.getTagParams(pensData, eventType);
|
799
763
|
// 详情页面,即URL配置了资产id的页面
|
800
764
|
let assetId = this.getUrlParams('assetId')
|
@@ -808,7 +772,7 @@ var Common = /** @class */ (function () {
|
|
808
772
|
if (this.assetPoperties) {
|
809
773
|
// 更新画布上固定的资产详情对应的值
|
810
774
|
//const canvasPens = this.pathRewrite ? canvasData.pens : this.canvas.data.pens
|
811
|
-
this.renderForAssetPoperties(
|
775
|
+
this.renderForAssetPoperties(this.canvas.data.pens);
|
812
776
|
}
|
813
777
|
}
|
814
778
|
};
|
@@ -882,18 +846,18 @@ var Common = /** @class */ (function () {
|
|
882
846
|
}
|
883
847
|
};
|
884
848
|
Common.prototype.getMqttData = async function (tagParams, panelData) {
|
885
|
-
let ret =
|
849
|
+
let ret = {};
|
886
850
|
let data = {};
|
887
851
|
let path = '';
|
888
852
|
let assetData = null;
|
889
853
|
let pathRewrite = this.pathRewrite;
|
890
|
-
let canvasData = JSON.parse(JSON.stringify(this.
|
891
|
-
let mqttTopics = this.
|
854
|
+
let canvasData = JSON.parse(JSON.stringify(this.canvas.data));
|
855
|
+
let mqttTopics = this.data.mqttTopics;
|
892
856
|
let tagParamsData = tagParams;
|
893
857
|
let detailJson = null;
|
894
858
|
Store.set('TIMEOUT:currentPage', `locationPath${this.s8()}`);
|
895
859
|
if (panelData) {
|
896
|
-
this.
|
860
|
+
this.data.mqttTopics = mqttTopics
|
897
861
|
pathRewrite = panelData.pathRewrite;
|
898
862
|
canvasData = JSON.parse(JSON.stringify(panelData.data));
|
899
863
|
mqttTopics = panelData.mqttTopics;
|
@@ -929,14 +893,7 @@ var Common = /** @class */ (function () {
|
|
929
893
|
this.theData = data
|
930
894
|
}
|
931
895
|
let drawedData = null
|
932
|
-
|
933
|
-
ret = await axios.post(path, data).catch(function(th) {
|
934
|
-
if(axios.isCancel(th)) {
|
935
|
-
console.log('请求取消了----', th.message);
|
936
|
-
} else {
|
937
|
-
console.log('请求失败----')
|
938
|
-
}
|
939
|
-
});
|
896
|
+
ret = await axios.post(path, data);
|
940
897
|
if (ret.data && ret.data.data) {
|
941
898
|
if (assetData) ret.data.data.asset = assetData
|
942
899
|
drawedData = this.mqttDataDrawing(canvasData, ret.data.data, detailJson)
|
@@ -963,7 +920,7 @@ var Common = /** @class */ (function () {
|
|
963
920
|
// console.log('收到消息', syncData)
|
964
921
|
Store.set('mqtt:responseData', syncData);
|
965
922
|
data.pens.map((item) => {
|
966
|
-
if (item.children
|
923
|
+
if (item.children != undefined) {
|
967
924
|
item.children.map((_item) => {
|
968
925
|
item.defaultFillStyle = item.fillStyle;
|
969
926
|
item.defaultFontColor = item.font.color;
|
@@ -1112,11 +1069,11 @@ var Common = /** @class */ (function () {
|
|
1112
1069
|
}
|
1113
1070
|
};
|
1114
1071
|
Common.prototype.onMqttContent = async function (tagParams) {
|
1115
|
-
if (!this.initType) this.
|
1072
|
+
if (!this.initType) this.data.mqttTopics = 'mqtt-' + s8();
|
1116
1073
|
// 告知MQTT属性中数据的集合
|
1117
1074
|
const ret = !this.initType ? await this.getMqttData(tagParams) : this.initType;
|
1118
1075
|
if (ret) {
|
1119
|
-
let mqttUrlStr = this.
|
1076
|
+
let mqttUrlStr = this.data.mqttUrl, mqttOption = this.data.mqttOptions
|
1120
1077
|
if (this.initData) {
|
1121
1078
|
const {mqttUrl, mqttOptions} = this.initData
|
1122
1079
|
mqttUrlStr = mqttUrl
|
@@ -1132,8 +1089,8 @@ var Common = /** @class */ (function () {
|
|
1132
1089
|
const index = eventType[4] ? eventType[4] : ''
|
1133
1090
|
// const url = 'pollUrl'+index;
|
1134
1091
|
// const second = 'pollSecond'+index;
|
1135
|
-
const pollUrl = this.
|
1136
|
-
const pollSecond = this.
|
1092
|
+
const pollUrl = this.data['pollUrl' + index]
|
1093
|
+
const pollSecond = this.data['pollSecond' + index]
|
1137
1094
|
this.onpollStop(eventType);
|
1138
1095
|
if (pollUrl && pollSecond) {
|
1139
1096
|
this.renderForPoll(tagParams, pollUrl, eventType);
|
@@ -1180,7 +1137,7 @@ var Common = /** @class */ (function () {
|
|
1180
1137
|
this.getMqttData(this.tagParams.Mqtt);
|
1181
1138
|
};
|
1182
1139
|
Common.prototype.doMqttDrow = function (ret) {
|
1183
|
-
let canvasData = this.
|
1140
|
+
let canvasData = this.canvas.data;
|
1184
1141
|
ret = JSON.parse(ret);
|
1185
1142
|
// console.log('处理消息')
|
1186
1143
|
// console.log('this.canvas.data',this.canvas.data)
|
@@ -1198,11 +1155,11 @@ var Common = /** @class */ (function () {
|
|
1198
1155
|
Common.prototype.hidePenVal = function (pen, val) {
|
1199
1156
|
const tags = pen.tags
|
1200
1157
|
const obj = val ? JSON.parse(val) : {}
|
1201
|
-
const visibleRange = obj.visibleRange
|
1202
|
-
const visibleFnRange = obj.visibleFnRange
|
1203
|
-
const visibleValue = obj.visibleValue
|
1204
|
-
const hiddenRange = obj.hiddenRange
|
1205
|
-
const tabsValue = obj.tabsValue
|
1158
|
+
const visibleRange = obj.visibleRange
|
1159
|
+
const visibleFnRange = obj.visibleFnRange
|
1160
|
+
const visibleValue = obj.visibleValue
|
1161
|
+
const hiddenRange = obj.hiddenRange
|
1162
|
+
const tabsValue = obj.tabsValue
|
1206
1163
|
if (tags.length > 0) {
|
1207
1164
|
if (visibleRange == '1') {
|
1208
1165
|
if (this.openCount % 2 == 0) {
|
@@ -1243,13 +1200,10 @@ var Common = /** @class */ (function () {
|
|
1243
1200
|
this.render();
|
1244
1201
|
};
|
1245
1202
|
Common.prototype.destroyStatic = function () {
|
1246
|
-
this.mqttDataSouse.cancel();
|
1247
|
-
this.clear('destroy');
|
1248
1203
|
this.clearInterValAll();
|
1249
|
-
|
1204
|
+
this.closeSocket();
|
1250
1205
|
this.closeMqtt();
|
1251
1206
|
this.closePoll();
|
1252
|
-
cancelAnimationFrame(this.renderTimer);
|
1253
1207
|
this.subcribe.unsubscribe();
|
1254
1208
|
this.subcribeRender.unsubscribe();
|
1255
1209
|
this.subcribeImage.unsubscribe();
|
@@ -1263,7 +1217,7 @@ var Common = /** @class */ (function () {
|
|
1263
1217
|
this.canvas = null;
|
1264
1218
|
this.offscreen.destroy();
|
1265
1219
|
this.offscreen = null;
|
1266
|
-
this.
|
1220
|
+
this.data = null;
|
1267
1221
|
Store.set('form:tableData', null);
|
1268
1222
|
Store.set('TIMEOUT:currentPage', `empty${this.s8()}`);
|
1269
1223
|
Store.set('FORM:tableData', {
|
package/core/src/core.d.ts
CHANGED
@@ -1,18 +1,19 @@
|
|
1
1
|
// @ts-ignore
|
2
2
|
import { EventType, Handler } from 'mitt';
|
3
3
|
import {Options, Padding} from './options';
|
4
|
-
import { Pen, Node, Point, Line } from './models';
|
4
|
+
import { Pen, Node, Point, Line, TopologyData } from './models';
|
5
5
|
import { HoverLayer } from './hoverLayer';
|
6
6
|
import { ActiveLayer } from './activeLayer';
|
7
|
+
import { DivLayer } from './divLayer';
|
7
8
|
import { Rect } from './models';
|
8
9
|
import {Common} from './common';
|
9
10
|
interface ICaches {
|
10
11
|
index: number;
|
11
|
-
list: [];
|
12
|
+
list: TopologyData[];
|
12
13
|
}
|
13
14
|
export declare class Topology extends Common{
|
14
15
|
constructor(parent: string | HTMLElement, options?: Options);
|
15
|
-
clipboard:
|
16
|
+
clipboard: TopologyData;
|
16
17
|
caches: ICaches;
|
17
18
|
private subcribeAnimateMoved;
|
18
19
|
private subcribeMediaEnd;
|