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/divLayer.d.ts
CHANGED
@@ -1,6 +1,11 @@
|
|
1
|
-
import {
|
1
|
+
import { Options } from './options';
|
2
|
+
import { Node } from './models/node';
|
3
|
+
import { TopologyData } from './models/data';
|
2
4
|
import { Layer } from './layer';
|
3
5
|
export declare class DivLayer extends Layer {
|
6
|
+
parentElem: HTMLElement;
|
7
|
+
options: Options;
|
8
|
+
protected data: TopologyData;
|
4
9
|
canvas: HTMLDivElement;
|
5
10
|
player: HTMLDivElement;
|
6
11
|
curNode: Node;
|
@@ -35,7 +40,7 @@ export declare class DivLayer extends Layer {
|
|
35
40
|
};
|
36
41
|
private subcribe;
|
37
42
|
private subcribeNode;
|
38
|
-
constructor(TID: String);
|
43
|
+
constructor(parentElem: HTMLElement, options: Options, TID: String);
|
39
44
|
addDiv: (node: Node) => void;
|
40
45
|
createPlayer(): void;
|
41
46
|
getMediaCurrent(): void;
|
package/core/src/divLayer.js
CHANGED
@@ -25,12 +25,16 @@ import {Lock} from './models/status';
|
|
25
25
|
import {PenType} from './models/pen';
|
26
26
|
import {Layer} from './layer';
|
27
27
|
import { setStyleForElementIdDiv, DomElements } from './utils'
|
28
|
-
import { commonStore } from './store'
|
29
28
|
var DivLayer = /** @class */ (function (_super) {
|
30
29
|
__extends(DivLayer, _super);
|
31
30
|
|
32
|
-
function DivLayer(TID) {
|
31
|
+
function DivLayer(parentElem, options, TID) {
|
32
|
+
if (options === void 0) {
|
33
|
+
options = {};
|
34
|
+
}
|
33
35
|
var _this = _super.call(this, TID) || this;
|
36
|
+
_this.parentElem = parentElem;
|
37
|
+
_this.options = options;
|
34
38
|
_this.canvas = document.createElement('div');
|
35
39
|
// _this.player = document.createElement('div');
|
36
40
|
// _this.videos = {};
|
@@ -91,6 +95,7 @@ var DivLayer = /** @class */ (function (_super) {
|
|
91
95
|
}
|
92
96
|
}
|
93
97
|
};
|
98
|
+
_this.data = Store.get(_this.generateStoreKey('topology-data'));
|
94
99
|
// if (!_this.options.playIcon) {
|
95
100
|
// _this.options.playIcon = 'iconfont icon-play';
|
96
101
|
// }
|
@@ -109,7 +114,7 @@ var DivLayer = /** @class */ (function (_super) {
|
|
109
114
|
_this.canvas.style.outline = 'none';
|
110
115
|
_this.canvas.style.background = 'transparent';
|
111
116
|
_this.canvas.setAttribute('class', 'canvas-point');
|
112
|
-
|
117
|
+
parentElem.appendChild(_this.canvas);
|
113
118
|
// parentElem.appendChild(_this.player);
|
114
119
|
//_this.createPlayer();
|
115
120
|
_this.subcribe = Store.subscribe(_this.generateStoreKey('LT:addDiv'), _this.addDiv);
|
@@ -159,7 +164,6 @@ var DivLayer = /** @class */ (function (_super) {
|
|
159
164
|
|
160
165
|
DivLayer.prototype.createPlayer = function () {
|
161
166
|
var _this = this;
|
162
|
-
let options = commonStore[_this.TID].options;
|
163
167
|
this.player.style.position = 'fixed';
|
164
168
|
this.player.style.outline = 'none';
|
165
169
|
this.player.style.top = '-99999px';
|
@@ -177,7 +181,7 @@ var DivLayer = /** @class */ (function (_super) {
|
|
177
181
|
this.progressCurrent = document.createElement('div');
|
178
182
|
this.loop = document.createElement('i');
|
179
183
|
var fullScreen = document.createElement('i');
|
180
|
-
this.playBtn.className = options.playIcon;
|
184
|
+
this.playBtn.className = this.options.playIcon;
|
181
185
|
this.playBtn.style.fontSize = '18px';
|
182
186
|
this.playBtn.style.lineHeight = '20px';
|
183
187
|
this.playBtn.style.cursor = 'pointer';
|
@@ -200,11 +204,11 @@ var DivLayer = /** @class */ (function (_super) {
|
|
200
204
|
this.loop.style.margin = '0 10px';
|
201
205
|
this.loop.style.padding = '2px 5px';
|
202
206
|
this.loop.style.borderRadius = '2px';
|
203
|
-
this.loop.className = options.loopIcon;
|
207
|
+
this.loop.className = this.options.loopIcon;
|
204
208
|
this.loop.style.fontSize = '18px';
|
205
209
|
this.loop.style.lineHeight = '20px';
|
206
210
|
this.loop.style.cursor = 'pointer';
|
207
|
-
fullScreen.className = options.fullScreenIcon;
|
211
|
+
fullScreen.className = this.options.fullScreenIcon;
|
208
212
|
fullScreen.style.fontSize = '17px';
|
209
213
|
fullScreen.style.lineHeight = '20px';
|
210
214
|
fullScreen.style.cursor = 'pointer';
|
@@ -217,10 +221,10 @@ var DivLayer = /** @class */ (function (_super) {
|
|
217
221
|
this.playBtn.onclick = function () {
|
218
222
|
if (_this.media.paused) {
|
219
223
|
_this.media.play();
|
220
|
-
_this.playBtn.className = options.pauseIcon;
|
224
|
+
_this.playBtn.className = _this.options.pauseIcon;
|
221
225
|
} else {
|
222
226
|
_this.media.pause();
|
223
|
-
_this.playBtn.className = options.playIcon;
|
227
|
+
_this.playBtn.className = _this.options.playIcon;
|
224
228
|
}
|
225
229
|
};
|
226
230
|
this.progress.onclick = function (e) {
|
@@ -238,7 +242,6 @@ var DivLayer = /** @class */ (function (_super) {
|
|
238
242
|
fullScreen.onclick = function () {
|
239
243
|
_this.media.requestFullscreen();
|
240
244
|
};
|
241
|
-
options = null;
|
242
245
|
};
|
243
246
|
DivLayer.prototype.getMediaCurrent = function () {
|
244
247
|
if (!this.media) {
|
@@ -291,7 +294,7 @@ var DivLayer = /** @class */ (function (_super) {
|
|
291
294
|
media.onended = function () {
|
292
295
|
Store.set(_this.generateStoreKey('mediaEnd'), node);
|
293
296
|
if (_this.media === media) {
|
294
|
-
_this.playBtn.className =
|
297
|
+
_this.playBtn.className = _this.options.playIcon;
|
295
298
|
}
|
296
299
|
_this.playNext(node.nextPlay);
|
297
300
|
};
|
@@ -313,7 +316,7 @@ var DivLayer = /** @class */ (function (_super) {
|
|
313
316
|
if (!next) {
|
314
317
|
return;
|
315
318
|
}
|
316
|
-
for (var _i = 0, _a =
|
319
|
+
for (var _i = 0, _a = this.data.pens; _i < _a.length; _i++) {
|
317
320
|
var item = _a[_i];
|
318
321
|
if (!(item instanceof Node)) {
|
319
322
|
continue;
|
@@ -342,7 +345,7 @@ var DivLayer = /** @class */ (function (_super) {
|
|
342
345
|
return node.img;
|
343
346
|
};
|
344
347
|
DivLayer.prototype.setElemPosition = function (node, elem) {
|
345
|
-
setStyleForElementIdDiv(node, elem,
|
348
|
+
setStyleForElementIdDiv(node, elem, this.data);
|
346
349
|
};
|
347
350
|
DivLayer.prototype.removeDiv = function (item) {
|
348
351
|
if (this.curNode && item.id === this.curNode.id) {
|
@@ -413,30 +416,25 @@ var DivLayer = /** @class */ (function (_super) {
|
|
413
416
|
return txt;
|
414
417
|
};
|
415
418
|
DivLayer.prototype.resize = function (size) {
|
416
|
-
let store = commonStore[this.TID];
|
417
|
-
if(!store || !store.options) return;
|
418
419
|
if (size) {
|
419
420
|
this.canvas.style.width = size.width + 'px';
|
420
421
|
this.canvas.style.height = size.height + 'px';
|
421
422
|
} else {
|
422
|
-
if (
|
423
|
-
this.canvas.style.width =
|
423
|
+
if (this.options.width && this.options.width !== 'auto') {
|
424
|
+
this.canvas.style.width = this.options.width + 'px';
|
424
425
|
} else {
|
425
|
-
this.canvas.style.width =
|
426
|
+
this.canvas.style.width = this.parentElem.clientWidth + 'px';
|
426
427
|
}
|
427
|
-
if (
|
428
|
-
this.canvas.style.height =
|
428
|
+
if (this.options.height && this.options.height !== 'auto') {
|
429
|
+
this.canvas.style.height = this.options.height + 'px';
|
429
430
|
} else {
|
430
|
-
this.canvas.style.height =
|
431
|
+
this.canvas.style.height = this.parentElem.clientHeight - 8 + 'px';
|
431
432
|
}
|
432
433
|
}
|
433
|
-
store = null;
|
434
434
|
};
|
435
435
|
DivLayer.prototype.render = function () {
|
436
|
-
|
437
|
-
for (var _i = 0, _a = commonStore[this.TID].data.pens; _i < _a.length; _i++) {
|
436
|
+
for (var _i = 0, _a = this.data.pens; _i < _a.length; _i++) {
|
438
437
|
var item = _a[_i];
|
439
|
-
if(!(item instanceof Node)) item = new Node(item);
|
440
438
|
if (!item.getTID()) {
|
441
439
|
item.setTID(this.TID);
|
442
440
|
}
|
@@ -459,6 +457,8 @@ var DivLayer = /** @class */ (function (_super) {
|
|
459
457
|
this.canvas.ondragover = null;
|
460
458
|
this.canvas.ondrop = null;
|
461
459
|
this.canvas.onwheel = null;
|
460
|
+
|
461
|
+
this.data = null;
|
462
462
|
//end
|
463
463
|
};
|
464
464
|
|
@@ -5,4 +5,4 @@ export declare function setNodeEvents(item: any[], pen: Pen): void;
|
|
5
5
|
export declare function setControlData(pen: Pen, syncData: Node): void;
|
6
6
|
export declare function getControlNode(item: any, data: any): Node;
|
7
7
|
export declare function getDetailData(data: Node): void;
|
8
|
-
export declare function setStatisticalData(pen: Pen,
|
8
|
+
export declare function setStatisticalData(pen: Pen, data: any): Node;
|
@@ -1,5 +1,4 @@
|
|
1
1
|
//let DETAILDATA = null;
|
2
|
-
import { echartsDefaultDataMap } from '../../../static/index';
|
3
2
|
export function setConfItemNode(pen, syn_synata) {
|
4
3
|
if (!pen.data) return
|
5
4
|
if(pen.data instanceof Array) {
|
@@ -79,6 +78,7 @@ export function setConfItemNode(pen, syn_synata) {
|
|
79
78
|
color = '#D38C00';
|
80
79
|
break;
|
81
80
|
}
|
81
|
+
|
82
82
|
// 显示的属性
|
83
83
|
if (name === 'text') {
|
84
84
|
pen.font.color = color
|
@@ -88,108 +88,73 @@ export function setConfItemNode(pen, syn_synata) {
|
|
88
88
|
}else {
|
89
89
|
pen.fillStyle = color
|
90
90
|
}
|
91
|
+
|
91
92
|
if (name === 'electricFan') setFanData(pen, _syn)
|
92
93
|
}else {
|
93
94
|
if (pen.elementRendered) pen.elementRendered = false;
|
94
|
-
if(pen.data.echarts) {
|
95
|
+
if(pen.data.params && pen.data.echarts) {
|
95
96
|
const { echartDataValue } = syn_synata;
|
97
|
+
//const seriesData = pen.data.echarts.option.series.length > 1 ? echartDataValue : echartData
|
96
98
|
const seriesData = echartDataValue;
|
97
|
-
|
98
|
-
const staticForType = pen.data.params && pen.data.params.staticForType || '';//统计类型:日,周,月,年
|
99
|
-
pen.data.echarts.option = setStatisticalData(pen, null, staticForType, chartData);
|
99
|
+
if(seriesData) pen.data.echarts = setStatisticalData(pen, seriesData)
|
100
100
|
}
|
101
101
|
}
|
102
102
|
return pen
|
103
103
|
}
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
* @param staticForType 统计类型:日,周,月,年
|
110
|
-
* @param chartData // 图表实时数据
|
111
|
-
* @returns {*}
|
112
|
-
*/
|
113
|
-
export function setStatisticalData(pen, dataType, staticForType, chartData) {
|
114
|
-
const node = JSON.parse(JSON.stringify(pen));
|
115
|
-
const echartsOption = node.data.echarts.option;
|
116
|
-
const displayMode = parseInt(echartsOption.displayMode);
|
117
|
-
const defaultData = echartsDefaultDataMap[`displayMode_${displayMode}`];
|
118
|
-
const staticTypeData = chartData && chartData[`${staticForType}_Data`];
|
119
|
-
const chartRealData = staticForType ? staticTypeData || defaultData : chartData || defaultData;
|
120
|
-
dataType = staticForType && staticTypeData ? '' : 'def';
|
121
|
-
if (displayMode === 1 || displayMode === 2){ // 折线图,柱状图
|
104
|
+
export function setStatisticalData(pen, echartData) {
|
105
|
+
const node = Object.assign({}, pen);
|
106
|
+
const displayMode = parseInt(node.data.echarts.option.displayMode);
|
107
|
+
const chartData = echartData[node.data.params.id];
|
108
|
+
if ((displayMode === 1 || displayMode === 2) && chartData){ // 折线图,柱状图
|
122
109
|
//const xData = [], seriesData = [];
|
123
|
-
const
|
124
|
-
const seriesNodes =
|
110
|
+
const staticForType = node.data.params.staticForType ? node.data.params.staticForType : '';//统计类型:日,周,月,年
|
111
|
+
const seriesNodes = node.data.echarts.option.series;
|
125
112
|
// 双轴曲线
|
126
|
-
if(seriesNodes.length > 1 || node.data.params
|
113
|
+
if(seriesNodes.length > 1 || node.data.params.curveNum > 1){
|
114
|
+
const chartOptions = staticForType ? chartData[`${staticForType}_Data`] : chartData;
|
127
115
|
const legendData = [];
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
}
|
135
|
-
|
136
|
-
displayMode === 1 ? defaultSeriesNode.data[i] -= 400 : defaultSeriesNode.data[i] += 100;
|
137
|
-
}
|
138
|
-
item.data = defaultSeriesNode.data;
|
139
|
-
}
|
140
|
-
}else {
|
141
|
-
const { name, data } = chartRealData.seriesData[index];
|
142
|
-
if(name) {
|
143
|
-
item.name = name;
|
144
|
-
legendData.push(name);
|
145
|
-
}
|
116
|
+
if(!chartOptions) return;
|
117
|
+
node.data.echarts.option.xAxis[0].data = chartOptions.XData;
|
118
|
+
let legend = node.data.echarts.option.legend;
|
119
|
+
if(chartOptions.seriesData.length) {
|
120
|
+
//循环给每条统计数据赋值
|
121
|
+
seriesNodes.map((item, index) => {
|
122
|
+
const { name, data } = chartOptions.seriesData[index];
|
123
|
+
item.name = name;
|
146
124
|
item.data = data;
|
147
|
-
|
148
|
-
|
149
|
-
|
125
|
+
legendData.push(name);
|
126
|
+
});
|
127
|
+
legend.data = legendData;
|
128
|
+
}else {
|
129
|
+
node.data.echarts.option.legend = [];
|
130
|
+
node.data.echarts.option.series = []
|
131
|
+
}
|
150
132
|
}else {
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
}
|
156
|
-
if(echartsOption.legend && echartsOption.legend.data.length) {
|
157
|
-
echartsOption.legend.data = [];
|
158
|
-
for(let i=0, legLeng=echartsOption.legend.data.length; i<legLeng; i++){
|
159
|
-
echartsOption.legend.data.push(`标注${i+1}`);
|
133
|
+
const chartOptions = staticForType ? chartData[`${staticForType}_Data`] : chartData;
|
134
|
+
if(chartOptions) {
|
135
|
+
node.data.echarts.option.xAxis[0].data = chartOptions.XData;
|
136
|
+
node.data.echarts.option.series[0].data = chartOptions.seriesData;
|
160
137
|
}
|
161
138
|
}
|
162
139
|
}
|
163
|
-
if(displayMode ===
|
164
|
-
|
165
|
-
const { data } = chartRealData.seriesData[0];
|
166
|
-
echartsOption.yAxis[1].data = data;
|
167
|
-
for (let i = 0; i < echartsOption.series.length; i++) {
|
168
|
-
const node = echartsOption.series[i];
|
169
|
-
node.symbolBoundingData = chartRealData.total;
|
170
|
-
node.data = data;
|
171
|
-
}
|
172
|
-
}
|
173
|
-
if (displayMode === 5 || displayMode === 3){ // 饼图/环形图
|
174
|
-
const colors = echartsOption.color;
|
175
|
-
const pieData = staticForType ? chartData || defaultData : chartData && chartData.data || defaultData.seriesData;
|
140
|
+
if (displayMode === 5 && chartData){ // 饼图
|
141
|
+
const colors = node.data.echarts.option.color;
|
176
142
|
const seriesData = [];
|
177
|
-
|
143
|
+
chartData.map((chd, index) => {
|
178
144
|
seriesData.push({
|
179
145
|
itemStyle: { color: colors[index] },
|
180
146
|
name: chd.name,
|
181
147
|
value: chd.value
|
182
148
|
})
|
183
149
|
})
|
184
|
-
|
150
|
+
node.data.echarts.option.series[0].data = seriesData;
|
185
151
|
}
|
186
|
-
if(displayMode === 6){ // 仪表盘
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
echartsOption.series[0].data[0].value = chartData && chartData.value || defaultData.value;
|
152
|
+
if(displayMode === 6 && chartData){ // 仪表盘
|
153
|
+
node.appearance.title.text = chartData.name;
|
154
|
+
node.data.echarts.option.title.text = chartData.name;
|
155
|
+
node.data.echarts.option.series[0].data[0].value = chartData.value;
|
191
156
|
}
|
192
|
-
return
|
157
|
+
return node.data.echarts;
|
193
158
|
}
|
194
159
|
export function setNodeEvents(item, pen) {
|
195
160
|
|
package/core/src/hoverLayer.d.ts
CHANGED
@@ -1,6 +1,13 @@
|
|
1
|
-
import {
|
1
|
+
import { TopologyData } from './models/data';
|
2
|
+
import { Rect } from './models/rect';
|
3
|
+
import { Point } from './models/point';
|
4
|
+
import { Line } from './models/line';
|
5
|
+
import { Node } from './models/node';
|
6
|
+
import { Options } from './options';
|
2
7
|
import { Layer } from './layer';
|
3
8
|
export declare class HoverLayer extends Layer {
|
9
|
+
options: Options;
|
10
|
+
protected data: TopologyData;
|
4
11
|
line: Line;
|
5
12
|
initLine: Line;
|
6
13
|
node: Node;
|
@@ -12,7 +19,7 @@ export declare class HoverLayer extends Layer {
|
|
12
19
|
dockLineY: number;
|
13
20
|
root: Node;
|
14
21
|
dragRect: Rect;
|
15
|
-
constructor(TID: String);
|
22
|
+
constructor(options: Options, TID: String);
|
16
23
|
lineTo(to: Point, toArrow?: string): void;
|
17
24
|
lineFrom(from: Point): void;
|
18
25
|
lineMove(pt: Point, initPos: {
|
package/core/src/hoverLayer.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) {
|
@@ -11,17 +11,22 @@ var __extends = (this && this.__extends) || (function () {
|
|
11
11
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
12
12
|
};
|
13
13
|
})();
|
14
|
-
import { Point
|
14
|
+
import { Point } from './models/point';
|
15
|
+
import { Node } from './models/node';
|
16
|
+
import { PenType } from './models/pen';
|
15
17
|
import { Store } from 'le5le-store';
|
18
|
+
import { Lock } from './models/status';
|
16
19
|
import { Layer } from './layer';
|
17
|
-
import { commonStore } from './store'
|
18
20
|
var HoverLayer = /** @class */ (function (_super) {
|
19
21
|
__extends(HoverLayer, _super);
|
20
|
-
function HoverLayer(TID) {
|
22
|
+
function HoverLayer(options, TID) {
|
23
|
+
if (options === void 0) { options = {}; }
|
21
24
|
var _this = _super.call(this, TID) || this;
|
25
|
+
_this.options = options;
|
22
26
|
_this.hoverAnchorIndex = -1;
|
23
27
|
_this.dockLineX = 0;
|
24
28
|
_this.dockLineY = 0;
|
29
|
+
_this.data = Store.get(_this.generateStoreKey('topology-data'));
|
25
30
|
Store.set(_this.generateStoreKey('LT:HoverLayer'), _this);
|
26
31
|
return _this;
|
27
32
|
}
|
@@ -65,16 +70,14 @@ var HoverLayer = /** @class */ (function (_super) {
|
|
65
70
|
};
|
66
71
|
HoverLayer.prototype.render = function (ctx) {
|
67
72
|
var _this = this;
|
68
|
-
if(
|
69
|
-
var globalStore = commonStore[_this.TID];
|
70
|
-
if (globalStore.data.locked === Lock.NoEvent) {
|
73
|
+
if (this.data.locked === Lock.NoEvent) {
|
71
74
|
return;
|
72
75
|
}
|
73
|
-
ctx.fillStyle =
|
76
|
+
ctx.fillStyle = this.options.hoverColor;
|
74
77
|
ctx.save();
|
75
78
|
// anchors
|
76
|
-
if (
|
77
|
-
|
79
|
+
if (this.options.alwaysAnchor) {
|
80
|
+
this.data.pens.forEach(function (pen) {
|
78
81
|
if (pen.type === PenType.Line) {
|
79
82
|
return;
|
80
83
|
}
|
@@ -87,23 +90,23 @@ var HoverLayer = /** @class */ (function (_super) {
|
|
87
90
|
continue;
|
88
91
|
}
|
89
92
|
ctx.beginPath();
|
90
|
-
ctx.arc(anchor.x, anchor.y, anchor.radius ||
|
91
|
-
ctx.strokeStyle = anchor.strokeStyle ||
|
92
|
-
ctx.fillStyle = anchor.fillStyle ||
|
93
|
+
ctx.arc(anchor.x, anchor.y, anchor.radius || _this.options.anchorRadius, 0, Math.PI * 2);
|
94
|
+
ctx.strokeStyle = anchor.strokeStyle || _this.options.hoverColor;
|
95
|
+
ctx.fillStyle = anchor.fillStyle || _this.options.anchorFillStyle;
|
93
96
|
ctx.fill();
|
94
97
|
ctx.stroke();
|
95
98
|
}
|
96
99
|
});
|
97
100
|
}
|
98
101
|
ctx.restore();
|
99
|
-
if (this.node && !
|
102
|
+
if (this.node && !this.data.locked) {
|
100
103
|
if (!this.node.getTID()) {
|
101
104
|
this.node.setTID(this.TID);
|
102
105
|
}
|
103
106
|
this.root = this.getRoot(this.node) || this.node;
|
104
107
|
if (this.root) {
|
105
108
|
ctx.save();
|
106
|
-
ctx.strokeStyle =
|
109
|
+
ctx.strokeStyle = this.options.dragColor;
|
107
110
|
ctx.globalAlpha = 0.2;
|
108
111
|
if (this.root.rotate) {
|
109
112
|
ctx.translate(this.root.rect.center.x, this.root.rect.center.y);
|
@@ -114,20 +117,20 @@ var HoverLayer = /** @class */ (function (_super) {
|
|
114
117
|
ctx.strokeRect(this.root.rect.x, this.root.rect.y, this.root.rect.width, this.root.rect.height);
|
115
118
|
ctx.restore();
|
116
119
|
}
|
117
|
-
if (!
|
120
|
+
if (!this.options.hideAnchor) {
|
118
121
|
for (var i = 0; i < this.node.rotatedAnchors.length; ++i) {
|
119
122
|
if (this.node.locked ||
|
120
|
-
|
121
|
-
|
123
|
+
this.node.hideAnchor ||
|
124
|
+
(this.node.rotatedAnchors[i].hidden && this.hoverAnchorIndex !== i)) {
|
122
125
|
continue;
|
123
126
|
}
|
124
127
|
ctx.beginPath();
|
125
|
-
ctx.arc(this.node.rotatedAnchors[i].x, this.node.rotatedAnchors[i].y, this.node.rotatedAnchors[i].radius ||
|
128
|
+
ctx.arc(this.node.rotatedAnchors[i].x, this.node.rotatedAnchors[i].y, this.node.rotatedAnchors[i].radius || this.options.anchorRadius, 0, Math.PI * 2);
|
126
129
|
ctx.strokeStyle =
|
127
|
-
|
130
|
+
this.node.rotatedAnchors[i].strokeStyle || this.options.hoverColor;
|
128
131
|
ctx.fillStyle =
|
129
|
-
|
130
|
-
|
132
|
+
this.node.rotatedAnchors[i].fillStyle ||
|
133
|
+
this.options.anchorFillStyle;
|
131
134
|
ctx.fill();
|
132
135
|
ctx.stroke();
|
133
136
|
}
|
@@ -136,9 +139,9 @@ var HoverLayer = /** @class */ (function (_super) {
|
|
136
139
|
if (this.dockAnchor) {
|
137
140
|
ctx.save();
|
138
141
|
ctx.beginPath();
|
139
|
-
ctx.arc(this.dockAnchor.x, this.dockAnchor.y, this.dockAnchor.radius ||
|
140
|
-
ctx.strokeStyle =
|
141
|
-
ctx.fillStyle =
|
142
|
+
ctx.arc(this.dockAnchor.x, this.dockAnchor.y, this.dockAnchor.radius || this.options.anchorRadius, 0, Math.PI * 2);
|
143
|
+
ctx.strokeStyle = this.options.dockStrokeStyle;
|
144
|
+
ctx.fillStyle = this.options.dockFillStyle;
|
142
145
|
ctx.fill();
|
143
146
|
ctx.stroke();
|
144
147
|
ctx.restore();
|
@@ -148,7 +151,7 @@ var HoverLayer = /** @class */ (function (_super) {
|
|
148
151
|
ctx.arc(this.hoverLineCP.x, this.hoverLineCP.y, 5, 0, Math.PI * 2);
|
149
152
|
ctx.fill();
|
150
153
|
}
|
151
|
-
ctx.strokeStyle =
|
154
|
+
ctx.strokeStyle = this.options.hoverColor + '80';
|
152
155
|
ctx.lineWidth = 1;
|
153
156
|
if (this.dockLineX > 0) {
|
154
157
|
var size = Store.get(this.generateStoreKey('LT:size'));
|
@@ -166,8 +169,8 @@ var HoverLayer = /** @class */ (function (_super) {
|
|
166
169
|
}
|
167
170
|
// Select nodes by drag.
|
168
171
|
if (this.dragRect) {
|
169
|
-
ctx.fillStyle =
|
170
|
-
ctx.strokeStyle =
|
172
|
+
ctx.fillStyle = this.options.dragColor + '30';
|
173
|
+
ctx.strokeStyle = this.options.dragColor;
|
171
174
|
ctx.beginPath();
|
172
175
|
ctx.strokeRect(this.dragRect.x, this.dragRect.y, this.dragRect.width, this.dragRect.height);
|
173
176
|
ctx.fillRect(this.dragRect.x, this.dragRect.y, this.dragRect.width, this.dragRect.height);
|
@@ -177,7 +180,7 @@ var HoverLayer = /** @class */ (function (_super) {
|
|
177
180
|
if (!node.parentId) {
|
178
181
|
return null;
|
179
182
|
}
|
180
|
-
for (var _i = 0, _a =
|
183
|
+
for (var _i = 0, _a = this.data.pens; _i < _a.length; _i++) {
|
181
184
|
var item = _a[_i];
|
182
185
|
if (item instanceof Node && item.id === node.parentId) {
|
183
186
|
var n = this.getRoot(item);
|
@@ -193,4 +196,4 @@ var HoverLayer = /** @class */ (function (_super) {
|
|
193
196
|
return HoverLayer;
|
194
197
|
}(Layer));
|
195
198
|
export { HoverLayer };
|
196
|
-
//# sourceMappingURL=hoverLayer.js.map
|
199
|
+
//# sourceMappingURL=hoverLayer.js.map
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import { Pen } from './pen';
|
2
|
+
import { Lock } from './status';
|
3
|
+
export declare class TopologyData {
|
4
|
+
pens: Pen[];
|
5
|
+
lineName: string;
|
6
|
+
fromArrowType: string;
|
7
|
+
toArrowType: string;
|
8
|
+
scale: number;
|
9
|
+
locked: Lock;
|
10
|
+
bkImage: string;
|
11
|
+
bkColor: string;
|
12
|
+
grid?: boolean;
|
13
|
+
websocket?: string;
|
14
|
+
mqttUrl?: string;
|
15
|
+
mqttOptions?: {
|
16
|
+
clientId?: string;
|
17
|
+
username?: string;
|
18
|
+
password?: string;
|
19
|
+
};
|
20
|
+
mqttTopics?: string;
|
21
|
+
manualCps?: boolean;
|
22
|
+
dataConstruct?: any;
|
23
|
+
data?: any;
|
24
|
+
bkImageRect?: any;
|
25
|
+
constructor(json?: any);
|
26
|
+
}
|
@@ -0,0 +1,77 @@
|
|
1
|
+
import { Node } from './node';
|
2
|
+
import { Line } from './line';
|
3
|
+
import { Lock } from './status';
|
4
|
+
import { s8 } from '../utils';
|
5
|
+
var TopologyData = /** @class */ (function () {
|
6
|
+
function TopologyData(json) {
|
7
|
+
this.pens = [];
|
8
|
+
this.lineName = 'curve';
|
9
|
+
this.fromArrowType = '';
|
10
|
+
this.toArrowType = 'triangleSolid';
|
11
|
+
this.scale = 1;
|
12
|
+
this.locked = Lock.None;
|
13
|
+
this.bkImageRect = null;
|
14
|
+
this.mqttOptions = {
|
15
|
+
clientId: s8()
|
16
|
+
};
|
17
|
+
this.dataConstruct = {};
|
18
|
+
if (json) {
|
19
|
+
this.pens = [];
|
20
|
+
json.dataConstruct = {};
|
21
|
+
for (var _i = 0, _a = json.pens; _i < _a.length; _i++) {
|
22
|
+
var item = _a[_i];
|
23
|
+
if (item.from) {
|
24
|
+
this.pens.push(new Line(item));
|
25
|
+
}
|
26
|
+
else {
|
27
|
+
if(item.name === 'formTable') {
|
28
|
+
json.dataConstruct[item.id] = {
|
29
|
+
id: item.id,
|
30
|
+
name: 'table'
|
31
|
+
}
|
32
|
+
}
|
33
|
+
this.pens.push(new Node(item));
|
34
|
+
}
|
35
|
+
}
|
36
|
+
this.lineName = json.lineName || 'curve';
|
37
|
+
this.fromArrowType = json.fromArrowType || '';
|
38
|
+
this.toArrowType = json.toArrowType || 'triangleSolid';
|
39
|
+
this.scale = json.scale || 1;
|
40
|
+
this.locked = json.locked || Lock.None;
|
41
|
+
this.bkImage = json.bkImage;
|
42
|
+
this.bkColor = json.bkColor;
|
43
|
+
this.grid = json.grid;
|
44
|
+
this.manualCps = json.manualCps;
|
45
|
+
this.websocket = json.websocket;
|
46
|
+
this.mqttUrl = json.mqttUrl;
|
47
|
+
this.bkImageRect = json.bkImageRect;
|
48
|
+
if (json.mqttOptions) {
|
49
|
+
var opts = '';
|
50
|
+
if (typeof json.mqttOptions === 'object') {
|
51
|
+
opts = JSON.stringify(json.mqttOptions);
|
52
|
+
}
|
53
|
+
else {
|
54
|
+
opts = json.mqttOptions + '';
|
55
|
+
}
|
56
|
+
this.mqttOptions = JSON.parse(opts);
|
57
|
+
}
|
58
|
+
else {
|
59
|
+
this.mqttOptions = { clientId: s8() };
|
60
|
+
}
|
61
|
+
this.dataConstruct = json.dataConstruct ? json.dataConstruct : {};
|
62
|
+
this.mqttTopics = json.mqttTopics;
|
63
|
+
if (typeof json.data === 'object') {
|
64
|
+
this.data = JSON.parse(JSON.stringify(json.data));
|
65
|
+
}
|
66
|
+
else {
|
67
|
+
this.data = json.data || '';
|
68
|
+
}
|
69
|
+
}
|
70
|
+
if (!this.mqttOptions) {
|
71
|
+
this.mqttOptions = { clientId: s8() };
|
72
|
+
}
|
73
|
+
}
|
74
|
+
return TopologyData;
|
75
|
+
}());
|
76
|
+
export { TopologyData };
|
77
|
+
//# sourceMappingURL=data.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"data.js","sourceRoot":"","sources":["../../../../packages/core/src/models/data.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAE9B;IAsBE,sBAAY,IAAU;QArBtB,SAAI,GAAU,EAAE,CAAC;QACjB,aAAQ,GAAG,OAAO,CAAC;QACnB,kBAAa,GAAG,EAAE,CAAC;QACnB,gBAAW,GAAG,eAAe,CAAC;QAC9B,UAAK,GAAG,CAAC,CAAC;QACV,WAAM,GAAG,IAAI,CAAC,IAAI,CAAC;QAMnB,gBAAW,GAIP;YACA,QAAQ,EAAE,EAAE,EAAE;SACf,CAAC;QAKF,IAAI,IAAI,EAAE;YACR,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;YACf,KAAmB,UAAS,EAAT,KAAA,IAAI,CAAC,IAAI,EAAT,cAAS,EAAT,IAAS,EAAE;gBAAzB,IAAM,IAAI,SAAA;gBACb,IAAI,IAAI,CAAC,IAAI,EAAE;oBACb,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;iBAChC;qBAAM;oBACL,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;iBAChC;aACF;YACD,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,OAAO,CAAC;YACzC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,IAAI,EAAE,CAAC;YAC9C,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,IAAI,eAAe,CAAC;YACvD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC;YAC7B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,IAAI,CAAC;YACvC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;YAC5B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;YAC5B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;YACtB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;YAEhC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;YAChC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;YAC5B,IAAI,IAAI,CAAC,WAAW,EAAE;gBACpB,IAAI,IAAI,GAAG,EAAE,CAAC;gBACd,IAAI,OAAO,IAAI,CAAC,WAAW,KAAK,QAAQ,EAAE;oBACxC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;iBACzC;qBAAM;oBACL,IAAI,GAAG,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;iBAC9B;gBACD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;aACrC;iBAAM;gBACL,IAAI,CAAC,WAAW,GAAG,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,CAAC;aACvC;YACD,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;YAElC,IAAI,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE;gBACjC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;aACnD;iBAAM;gBACL,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;aAC7B;SACF;QACD,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;YACrB,IAAI,CAAC,WAAW,GAAG,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,CAAC;SACvC;IACH,CAAC;IACH,mBAAC;AAAD,CAAC,AAnED,IAmEC"}
|
package/core/src/models/index.js
CHANGED