dcim-topology2d 2.0.7 → 2.0.8

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.
@@ -1,6 +1,7 @@
1
1
  import {s8, createDiv, rectangle, commonStore} from '../../../core';
2
2
  import {plugsPool} from '../../../store';
3
3
  import {
4
+ setMapScatterOptions,
4
5
  setMapLineBarOptions,
5
6
  setMapGaugeOptions,
6
7
  setMapRingOptions,
@@ -72,8 +73,10 @@ export function echarts(ctx, node) {
72
73
  if (!appearance.type) appearance.type = echartsTypeMap[`type_${option.displayMode}`]; // 兼容旧数据配置
73
74
  // 公共配置 Top排行榜散点图跳过公共属性配置
74
75
  if (option.displayMode !== 4 && option.displayMode !== 7) setMapGlobalOptions(option, node);
76
+ // 散点图
77
+ if (appearance.type.includes('scatter')) setMapScatterOptions(option, node);
75
78
  // 折线图和柱状图
76
- if (['line', 'bar'].includes(appearance.type)) setMapLineBarOptions(option, node);
79
+ if (appearance.type.includes('line') || appearance.type.includes('bar')) setMapLineBarOptions(option, node);
77
80
  // 仪表盘
78
81
  if (appearance.type === 'gauge') setMapGaugeOptions(option, node);
79
82
  // 环形图 || 饼图
@@ -94,6 +94,14 @@ export function setChartYAxisData(yAxis, appearance) {
94
94
  if (!appearance.ysplitLineLineStyle && yAxis[0].splitLine.show) {
95
95
  appearance.ysplitLineLineStyle = JSON.parse(JSON.stringify(echartsYAxisDefaultStyleData['ysplitLineLineStyle']));
96
96
  }
97
+ if(appearance.total && appearance.total.length && appearance.totalLabelSynchroYData) {
98
+ const newYAxisData = [];
99
+ for (let i = 0; i < appearance.total.length; i++) {
100
+ const item = appearance.total[i];
101
+ if(item.value) newYAxisData.push(item.label);
102
+ }
103
+ yAxis[0].data = newYAxisData;
104
+ }
97
105
  for (let i = 0; i < yAxis.length; i++) {
98
106
  const item = yAxis[i];
99
107
  if(!item.axisLabel) item.axisLabel = {};
@@ -7,6 +7,7 @@ interface echartsOptions {
7
7
  }
8
8
  export declare function getXYAxisLabelVal(index: number, intervalNum: number, value: any): string;
9
9
  export declare function initBindTabSetting(node: any): string;
10
+ export declare function setMapScatterOptions(option: echartsOptions, node: any): void;
10
11
  export declare function setMapLineBarOptions(option: echartsOptions, node: any): void;
11
12
  export declare function setMapGaugeOptions(option: echartsOptions, node: any): void;
12
13
  export declare function setMapRingOptions(option: echartsOptions, node: any): void;
@@ -79,6 +79,33 @@ export function setMapStopAutoMoveOptions(chartNode) {
79
79
 
80
80
  }
81
81
 
82
+ // 自动配置散点图的节点数据
83
+ export function setMapScatterOptions(option, node) {
84
+ if(node.appearance.series) {
85
+ for (let i = 0; i < option.series.length; i++) {
86
+ const series = option.series[i];
87
+ const setSeries = node.appearance.series[i];
88
+ if(setSeries) {
89
+ series.itemStyle.color = setSeries.itemColor;
90
+ series.itemStyle.borderColor = setSeries.itemBorderColor;
91
+ }
92
+ }
93
+ }
94
+ if(node.appearance.yAxis && node.appearance.yAxis.axisLabel && node.appearance.yAxis.axisLabel.length) {
95
+ const yAxisAxisLabelRich = option.yAxis[0].axisLabel.rich;
96
+ const yAxisAxisLabel = node.appearance.yAxis.axisLabel;
97
+ const yAxisData = [];
98
+ for (let i = 0; i < yAxisAxisLabel.length; i++) {
99
+ const axisLabel = yAxisAxisLabel[i];
100
+ yAxisAxisLabelRich[`f${i+1}`] = {
101
+ color: axisLabel.color
102
+ };
103
+ if(axisLabel.label) yAxisData.push(axisLabel.label);
104
+ }
105
+ option.yAxis[0].data = yAxisData;
106
+ }
107
+ }
108
+
82
109
  // 自动配置折线和柱状图的节点数据
83
110
  export function setMapLineBarOptions(option, node) {
84
111
  option.color = node.appearance.color;
@@ -88,11 +115,17 @@ export function setMapLineBarOptions(option, node) {
88
115
  option.yAxis[0].axisLabel.formatter = function (value, index) {
89
116
  return getXYAxisLabelVal(index, node.appearance.intervalNumY, value);
90
117
  }
91
- if (option.series.length < 2) {
92
- option.tooltip.formatter = function (params) {
93
- const item = params[0];
94
- return item.name + ' : ' + item.value;
118
+ if(option.series.length < 2) return;
119
+ const total = node.appearance.total;
120
+ if(total && total.length) {
121
+ const seriesData = option.series[0].data;
122
+ if(seriesData.length < total.length && total[total.length - 1].value) seriesData.push(20);
123
+ const data2 = [];
124
+ for (let i = 0; i < seriesData.length; i++) {
125
+ const dr = node.appearance.total[i] ? node.appearance.total[i].value - Number(seriesData[i]) : option.series[1].data[i];
126
+ data2.push(dr);
95
127
  }
128
+ option.series[1].data = data2;
96
129
  }else {
97
130
  option.series.map((item, index) => {
98
131
  if(!(item.itemStyle && item.itemStyle.normal && item.itemStyle.normal.color)) {
@@ -298,13 +331,13 @@ export function setMapDataOptions(option, node) {
298
331
  if(node.tabData && node.tabData.data.state && optionNode.yAxis[0].max) Object.assign(optionNode.yAxis[0], node.tabData.data); //若Tabs切换配置了数据,则修改Y轴原有配置
299
332
 
300
333
  if(appearance.type === 'barPileStatic') {
301
-
334
+
302
335
  barPileStaticDataAuto(optionNode, staticTypeData, appearance);
303
-
336
+
304
337
  }else {
305
-
306
- lineBarDataAuto(optionNode, params, staticTypeData);
307
-
338
+
339
+ lineBarDataAuto(optionNode, params, staticTypeData, appearance);
340
+
308
341
  }
309
342
 
310
343
  }
@@ -1,4 +1,4 @@
1
- import {rankingTopImageName, rankingTopColorList} from '../../../static';
1
+ import {rankingTopColorList} from '../../../static';
2
2
 
3
3
  export function mapFormatterSet(appearance, options, data) {
4
4
  if(appearance.type.includes('ring') || appearance.type.includes('pie')) {
@@ -7,6 +7,7 @@ export function mapFormatterSet(appearance, options, data) {
7
7
  setMapRingOptionsFormatter(appearance, seriesNode);
8
8
  }
9
9
  }
10
+ if(appearance.type.includes('line') || appearance.type.includes('bar')) setMapLineBarFormatter(appearance, options);
10
11
  if(appearance.type.includes('lineTwins')) setMapLineTwinsFormatter(appearance, options);
11
12
  if(appearance.type.includes('scatter')) setMapScatterFormatter(options);
12
13
  if(appearance.type.includes('TOPRanking')) setMapTopScoreFormatter(options, data, appearance);
@@ -30,23 +31,59 @@ function setMapLineTwinsFormatter(appearance, options) {
30
31
  }
31
32
  }
32
33
  }
34
+ // 折线 || 柱状图
35
+ function setMapLineBarFormatter(appearance, options){
36
+ if(!options.tooltip.formatter){
37
+ options.tooltip.formatter = function(param) {
38
+ const firstUnit = getTooltipUnit(0, appearance);
39
+ const firstDott = getTooltipDott(param[0].color);
40
+ let data = `${firstDott}${param[0].seriesName}:${param[0].value} ${firstUnit}`;
41
+ for (let i = 1; i < param.length; i++){
42
+ const item = param[i];
43
+ const unit = getTooltipUnit(i, appearance);
44
+ const dott = getTooltipDott(param[i].color);
45
+ data += `<br>${dott}${item.seriesName}:${item.value} ${unit}`;
46
+ }
47
+ return `<div style="border-bottom: 1px solid rgba(255,255,255,.3); font-size: 12px;margin-bottom: 5px;">${param[0].name}</div>${data}`;
48
+ }
49
+ }
50
+ }
51
+ function getTooltipUnit(index, appearance) {
52
+ if(!(appearance.tooltipUnit && appearance.tooltipUnit[index])) return '';
53
+ return appearance.tooltipUnit[index];
54
+ }
55
+ function getTooltipDott(color) {
56
+ return `<span style="display: inline-block;margin-right: 8px;border: 5px solid ${color};border-radius: 100%"></span>`;
57
+ }
33
58
  // 堆叠统计
34
59
  function setMapBarPileStaticFormatter(appearance, options) {
35
60
  if(!options.tooltip.formatter){
36
61
  options.tooltip.formatter = function(param) {
37
- return `<div style="border-bottom: 1px solid rgba(255,255,255,.3); font-size: 12px;margin-bottom: 5px;">${param[0].name}</div>${param[0].seriesName}:${param[0].value}<br>${param[1].seriesName}:${appearance.total[param[1].dataIndex]}`;
62
+ let data = `${param[0].seriesName}:${param[0].value} ${appearance.series[0] && appearance.series[0].labelUnit || ''}`;
63
+ for (let i = 1; i < param.length; i++){
64
+ const item = param[i];
65
+ const series = appearance.series[i];
66
+ data += `<br>${item.seriesName}:${appearance.total && appearance.total[item.dataIndex].value || item.value} ${series && series.labelUnit || ''}`;
67
+ }
68
+ return `<div style="border-bottom: 1px solid rgba(255,255,255,.3); font-size: 12px;margin-bottom: 5px;">${param[0].name}</div>${data}`;
69
+ }
70
+ }
71
+ for (let i = 0; i < options.series.length; i++) {
72
+ const item = options.series[i];
73
+ const setItem = appearance.series[i];
74
+ if(setItem) {
75
+ item.itemStyle.normal.color = setItem.itemColor;
76
+ item.label.color = setItem.labelColor;
77
+ item.label.fontSize = setItem.labelSize;
78
+ item.label.padding[0] = setItem.labelTop;
38
79
  }
80
+ item.label.formatter = `{c}${setItem ? setItem.labelUnit : ''}`;
39
81
  }
40
- if(!options.series[1].label.formatter){
82
+ if(appearance.total && appearance.total.length) {
41
83
  options.series[1].label.formatter = function(param) {
42
84
  if(!param.value) return '';
43
- let value = '';
44
- if(appearance.totalStyle) {
45
- value = `${appearance.totalStyle.label ? appearance.total[param.dataIndex] : ''}${appearance.totalStyle.unit}`;
46
- }else {
47
- value = `${appearance.total[param.dataIndex]}`;
48
- }
49
- return value;
85
+ const val = appearance.totalLabel ? appearance.total[param.dataIndex].value || options.series[1].data[param.dataIndex] : '';
86
+ return `${val}${appearance.series[1].labelUnit}`;
50
87
  }
51
88
  }
52
89
  }
@@ -61,18 +98,22 @@ function setMapTopScoreFormatter(options, data, appearance) {
61
98
  const seriesNode = options.series[0];
62
99
  if(appearance.total && appearance.total.length) {
63
100
  const realData = data && data.seriesData && data.seriesData[0] && data.seriesData[0].data;
64
- if(realData && realData.length) {
65
- seriesNode.data = appearance.total;
66
- seriesNode.itemStyle.normal.label.formatter = function(param) {
67
- return `${realData[param.dataIndex]}${appearance.unit}`;
68
- }
101
+ const normalData = [28.7, 24.2, 20.3, 19.8, 19.3];
102
+ const resultData = realData && realData.length ? realData : normalData;
103
+ seriesNode.itemStyle.normal.label.formatter = function(param) {
104
+ return `${resultData[param.dataIndex]}${appearance.unit}`;
105
+ }
106
+ for(let i = 0; i < appearance.total.length; i++) {
107
+ const value = appearance.total[i].value;
108
+ seriesNode.data[i] = value ? parseInt(value) : normalData[i];
69
109
  }
70
110
  }
71
111
  if(seriesNode.itemStyle.normal.color) return;
112
+ const colorList = appearance.barColor || rankingTopColorList;
72
113
  for (let i = 0; i < options.series.length; i++) {
73
114
  const node = options.series[i];
74
115
  node.itemStyle.normal.color = function(params) {
75
- return rankingTopColorList[params.dataIndex];
116
+ return colorList[params.dataIndex];
76
117
  }
77
118
  }
78
119
  }
@@ -1,4 +1,4 @@
1
- export declare function lineBarDataAuto(option: any, params: {}, data: {}): void;
1
+ export declare function lineBarDataAuto(option: any, params: {}, data: {}, appearance: {}): void;
2
2
  export declare function barPileStaticDataAuto(option: any, data: {}, appearance: {}): void;
3
3
  export declare function topRankingListAuto(option: any, data: {}, appearance: {}): void;
4
4
  export declare function scatterDataAuto(option: any, data: {}): void;
@@ -5,8 +5,9 @@ import {echartsColorData} from "../../../static";
5
5
  * @param option 图表配置数据
6
6
  * @param params 绑定的图表参数
7
7
  * @param data 实时图表数据
8
+ * @param appearance 配置参数
8
9
  */
9
- export function lineBarDataAuto(option, params, data) {
10
+ export function lineBarDataAuto(option, params, data, appearance) {
10
11
  const seriesNodes = option.series;
11
12
  if(data && data.XData) option.xAxis[0].data = data.XData;
12
13
  if(!(data && data.seriesData && data.seriesData.length)) return;
@@ -19,6 +20,25 @@ export function lineBarDataAuto(option, params, data) {
19
20
  }
20
21
  if(seriesNodes.length > 1 || params && params.curveNum > 1){
21
22
  // 双曲线|柱状
23
+ if(option.yAxis.length > 1 && appearance.yAxisValueAuto) {
24
+ if(!appearance.yAxisMaxIntervalue) appearance.yAxisMaxIntervalue = 1;
25
+ // 双轴曲线,且曲线值为自适应
26
+ const dataGroup = {
27
+ data1: data.seriesData[0] && data.seriesData[0].data || [],
28
+ data2: data.seriesData[1] && data.seriesData[1].data || []
29
+ };
30
+ const newData = [...dataGroup.data1, ...dataGroup.data2];
31
+ let min = Math.min(...newData);
32
+ let max = Math.max(...newData);
33
+ const power = Math.floor(Math.log10(min));
34
+ for (let i = 0; i < option.yAxis.length; i++) {
35
+ const currentData = dataGroup[`data${i + 1}`];
36
+ if(min < 0 && Math.max(...currentData) < max) max *= appearance.yAxisMaxIntervalue;
37
+ if(min > 0 && Math.max(...currentData) < max) min = Math.pow(10, power);
38
+ option.yAxis[i].min = Math.ceil(min);
39
+ option.yAxis[i].max = Math.ceil(max);
40
+ }
41
+ }
22
42
  const legendData = [];
23
43
  let legendChange = false;
24
44
  seriesNodes.map((item, index) => {
@@ -37,7 +57,16 @@ export function lineBarDataAuto(option, params, data) {
37
57
  let seriesData = [];
38
58
  for (let i = 0; i < data.seriesData.length; i++){
39
59
  const realSeriesNode = data.seriesData[i];
40
- const currSeriesNode = seriesNodes[i] ? seriesNodes[i] : JSON.parse(JSON.stringify(seriesNodes[0]));
60
+ let currSeriesNode = {};
61
+ const seriesItem = seriesNodes[i];
62
+ if(seriesItem) {
63
+ currSeriesNode = seriesItem;
64
+ }else {
65
+ const newSeriesItem = JSON.parse(JSON.stringify(seriesNodes[0]));
66
+ newSeriesItem.itemStyle.normal.lineStyle.color = echartsColorData[i];
67
+ newSeriesItem.itemStyle.normal.color = echartsColorData[i];
68
+ currSeriesNode = newSeriesItem;
69
+ }
41
70
  if(realSeriesNode.name) currSeriesNode.name = realSeriesNode.name;
42
71
  currSeriesNode.data = realSeriesNode.data;
43
72
  seriesData.push(currSeriesNode);
@@ -53,7 +82,7 @@ export function barPileStaticDataAuto(option, data, appearance) {
53
82
  option.series[0].data = seriesData;
54
83
  const data2 = [];
55
84
  for (let i = 0; i < seriesData.length; i++) {
56
- const dr = appearance.total[i] - Number(seriesData[i]);
85
+ const dr = appearance.total[i] ? appearance.total[i].value - Number(seriesData[i]) : data.seriesData[1].data[i];
57
86
  data2.push(dr);
58
87
  }
59
88
  option.series[1].data = data2;
@@ -62,9 +62,10 @@ var Canvas = /** @class */ (function (_super) {
62
62
  }
63
63
  this.canvas.style.width = this.width + 'px';
64
64
  this.canvas.style.height = this.height + 'px';
65
- this.canvas.width = (this.width * Canvas.dpiRatio) | 0;
66
- this.canvas.height = (this.height * Canvas.dpiRatio) | 0;
67
- this.canvas.getContext('2d').scale(Canvas.dpiRatio, Canvas.dpiRatio);
65
+ const dpr = window.devicePixelRatio || 1;
66
+ this.canvas.width = (this.width * dpr) | 0;
67
+ this.canvas.height = (this.height * dpr) | 0;
68
+ this.canvas.getContext('2d').scale(dpr, dpr);
68
69
  Store.set(this.generateStoreKey('LT:size'), { width: this.canvas.width, height: this.canvas.height });
69
70
  };
70
71
  Canvas.prototype.render = function () {
@@ -14,12 +14,10 @@ import {
14
14
  setInitConfData,
15
15
  getParams,
16
16
  tabHideShowOperation,
17
- tabStaticOperation,
18
- echartsStaticType
17
+ tabStaticOperation
19
18
  } from './utils';
20
19
  import {useStore, clearStore, commonStore} from './store'
21
20
  import * as mqtt from './mqtt.min';
22
- import {setElementSwitchTabState} from './element';
23
21
  var MoveInType;
24
22
  (function (MoveInType) {
25
23
  MoveInType[MoveInType["None"] = 0] = "None";
@@ -259,7 +257,7 @@ var Common = /** @class */ (function () {
259
257
  this.store.parentElem.style.transformOrigin = '0 0';
260
258
  this.store.parentElem.parentElement.style.overflow = 'hidden';
261
259
  Store.set('PAGE:zoom', zoom);
262
- };
260
+ }
263
261
  this.store.data.pens = [];
264
262
  this.openCount = 0
265
263
  const type = this.store.options.type;
@@ -504,7 +502,7 @@ var Common = /** @class */ (function () {
504
502
  }
505
503
  penNode.activeImgeIndex = isActive;
506
504
  tabIndex++;
507
- if(staticType === 'SH') tabHideShowOperation(switchNode, tabAreaData); // 对显示隐藏的功能进行交互处理
505
+ if(staticType === 'SH') tabHideShowOperation(switchNode, tabAreaData, isActive); // 对显示隐藏的功能进行交互处理
508
506
  }
509
507
  // 对绑定的图表进行数据处理
510
508
  tabStaticOperation(staticType, node, tabAreaData, visitParams);
@@ -2,7 +2,13 @@ import {jsonLength} from '../utils';
2
2
  import {commonStore} from "../store";
3
3
  // 设置tab切换显示隐藏时的 Dom元件状态
4
4
  export function setElementSwitchTabState(node) {
5
- if(node.name !== 'echarts' && (!node.children || !node.children.length)) return;
5
+ if(node.children && node.children.length) {
6
+ node.children.map((ch) => {
7
+ ch.visible = node.visible;
8
+ setElementSwitchTabState(ch);
9
+ })
10
+ }
11
+ if(!(node.name === 'echarts' || node.name === 'select')) return;
6
12
  if(typeof commonStore[node.TID].elementInteractivePoor.elementDataLength !== 'number') {
7
13
  commonStore[node.TID].elementInteractivePoor.elementDataLength = jsonLength(commonStore[node.TID].echartsDataPool) || jsonLength(commonStore[node.TID].selectDataPool);
8
14
  }
@@ -14,10 +20,4 @@ export function setElementSwitchTabState(node) {
14
20
  }else {
15
21
  commonStore[node.TID].data.dataResize = 1;
16
22
  }
17
- if(node.children && node.children.length) {
18
- node.children.map((ch) => {
19
- ch.visible = node.visible;
20
- setElementSwitchTabState(ch);
21
- })
22
- }
23
23
  }
@@ -657,10 +657,21 @@ var Node = /** @class */ (function (_super) {
657
657
  if (item.linear) {
658
658
  // 线条左右流动动画
659
659
  if([animateType.LeftFlow, animateType.RightFlow].includes(this.animateType) && item.state.lineDashOffset){
660
- const lineDashOffset = item.state.lineDashOffset;
661
- if (lineDashOffset > 100) item.state.lineDashOffset = 1;
662
- if (lineDashOffset < -100) item.state.lineDashOffset = -1;
663
- lineDashOffset > 0 ? item.state.lineDashOffset++ : item.state.lineDashOffset--;
660
+ let o = item.state.lineDashOffset;
661
+ switch (this.animateType) {
662
+ case animateType.LeftFlow:
663
+ o = Math.abs(o)
664
+ if (o > 100) o = 1;
665
+ o++
666
+
667
+ break;
668
+ case animateType.RightFlow:
669
+ o = Math.abs(o)*-1
670
+ if (o < -100) o = -1;
671
+ o--
672
+ break;
673
+ }
674
+ item.state.lineDashOffset = o
664
675
  this.lineDashOffset = item.state.lineDashOffset;
665
676
  }else if(([animateType.Show, animateType.Rotate].includes(this.animateType) || this.name === 'electricFan') && item.state.rotate !== item.initState.rotate) {
666
677
  // 旋转动画,判断逻辑先这么写,日后将所有动画统一在编辑器中配置,再做优化
@@ -105,7 +105,7 @@ var Preview = (function (_super) {
105
105
  if (visibleRange == '1') {
106
106
  _this.openCount++
107
107
  }
108
- this.render();
108
+ _this.render();
109
109
  break;
110
110
  case downDataType.Tabswitch:
111
111
  _this.switchStaticsCheckType(_this.moveIn.hoverNode, _this.moveIn.eventNode);
@@ -93,7 +93,7 @@ var RenderLayer = /** @class */ (function (_super) {
93
93
  this.bkImg.src = bkImage;
94
94
  this.bkImg.onload = function () {
95
95
  if(pixi && !_this.bkImgRect) {
96
- _this.bkImgRectResize({width: _this.canvas.width, height: _this.canvas.height});
96
+ _this.bkImgRectResize({width: _this.width, height: _this.height});
97
97
  _this.scale(_this.ratio, undefined, _this.scaleX, _this.scaleY);
98
98
  }else {
99
99
  //_this.bkImgRect = _this.coverRect(_this.canvas.width, _this.canvas.height, _this.bkImg.width, _this.bkImg.height);
@@ -137,10 +137,10 @@ var RenderLayer = /** @class */ (function (_super) {
137
137
  RenderLayer.prototype.bkImgRectResize = function (size) {
138
138
  const bkImageRect = commonStore[this.TID].data.bkImageRect;
139
139
  if(!size) return;
140
+ const { width, height } = size;
140
141
  if(bkImageRect) {
141
142
  let x = bkImageRect.x ? Number(bkImageRect.x) : 0;
142
143
  let y = bkImageRect.y ? Number(bkImageRect.y) : 0;
143
- const { width, height } = size;
144
144
  let bkWidth = bkImageRect.width ? Number(bkImageRect.width) : width;
145
145
  let bkHeight = bkImageRect.height ? Number(bkImageRect.height) : height;
146
146
  this.bkImgRect = {
@@ -157,6 +157,17 @@ var RenderLayer = /** @class */ (function (_super) {
157
157
  x,
158
158
  y
159
159
  };
160
+ }else {
161
+ this.bkImgRect = {
162
+ center: {
163
+ x: width / 2,
164
+ y: height / 2
165
+ },
166
+ x: 0,
167
+ y: 0,
168
+ width,
169
+ height
170
+ };
160
171
  }
161
172
  };
162
173
 
@@ -26,6 +26,7 @@ export interface visualization2DData {
26
26
  mqttTopics?: string;
27
27
  manualCps?: boolean;
28
28
  dataConstruct?: any;
29
+ bindDataTooltipVisible?: boolean;
29
30
  data?: any;
30
31
  bkImageRect?: any;
31
32
  }
@@ -88,7 +89,8 @@ export const createStore = () => {
88
89
  mqttOptions: {
89
90
  clientId: s8()
90
91
  },
91
- dataConstruct: {}
92
+ dataConstruct: {},
93
+ bindDataTooltipVisible: true
92
94
  },
93
95
  mqttData: null,
94
96
  initConfNode: {},
@@ -159,7 +161,8 @@ export const clearStore = (store: visualization2DStore, del: string) => {
159
161
  mqttOptions: {
160
162
  clientId: s8()
161
163
  },
162
- dataConstruct: {}
164
+ dataConstruct: {},
165
+ bindDataTooltipVisible: true
163
166
  };
164
167
  store.mqttData = null;
165
168
  store.initConfNode = {};
@@ -13,7 +13,7 @@ import { default as mitt } from 'mitt';
13
13
  import { Lock } from '../models';
14
14
  import {DefalutOptions} from '../options';
15
15
  import {s8} from '../utils';
16
- import {commonStore} from './common'
16
+ import {commonStore} from './common';
17
17
  import {removeAllElement} from '../../../store';
18
18
  export var createStore = function () {
19
19
  return {
@@ -31,7 +31,8 @@ export var createStore = function () {
31
31
  mqttOptions: {
32
32
  clientId: s8()
33
33
  },
34
- dataConstruct: {}
34
+ dataConstruct: {},
35
+ bindDataTooltipVisible: true
35
36
  },
36
37
  mqttData: null,
37
38
  initConfNode: {},
@@ -136,7 +137,8 @@ export var clearStore = function (store, del) {
136
137
  mqttOptions: {
137
138
  clientId: s8()
138
139
  },
139
- dataConstruct: {}
140
+ dataConstruct: {},
141
+ bindDataTooltipVisible: true
140
142
  };
141
143
  store.initConfNode = {};
142
144
  store.mqttParams = {
@@ -16,7 +16,12 @@ export function setInitNodeDataValidat(node, TID, type, order) {
16
16
 
17
17
  node.TID = TID;
18
18
 
19
- node.visibleSwitch = type === 'topology' && node.visibleSwitch;
19
+ if(typeof node.visibleSwitch !== 'boolean') {
20
+ // 兼容旧版显示隐藏属性值设置
21
+ node.visibleSwitch = type === 'topology';
22
+ }else {
23
+ node.visibleSwitch = type === 'topology' && node.visibleSwitch;
24
+ }
20
25
 
21
26
  if(typeof order === "number") node.order = order;
22
27
  if(type !== 'topology') node.selectDropdown = false;
@@ -1,6 +1,6 @@
1
1
  import {Node} from "../models";
2
2
  export declare function tabStaticOperation(type: string, node: Node, areaData: any, params: object): void;
3
- export declare function tabHideShowOperation(node: any, areaData: any): void;
3
+ export declare function tabHideShowOperation(node: any, areaData: any, visible: boolean): void;
4
4
  export declare function getEchartsRealData(node: {}, data: []): void;
5
5
  export declare function setInitConfData(id: string, data: object): void;
6
6
  export declare function setTagIdData(data: any): [];
@@ -38,8 +38,9 @@ export function tabStaticOperation(type, node, areaData, params) {
38
38
  * Tab 显示/隐藏切换
39
39
  * @param node tab页签数据
40
40
  * @param areaData // tab展示区域数据
41
+ * @param isActive
41
42
  */
42
- export function tabHideShowOperation(node, areaData) {
43
+ export function tabHideShowOperation(node, areaData, isActive) {
43
44
  const confIds = node.bindStaticId && node.bindStaticId.split(',') || [];
44
45
  const pens = commonStore[node.TID].data.pens;
45
46
  for (let i = 0; i < confIds.length; i++) {
@@ -47,7 +48,7 @@ export function tabHideShowOperation(node, areaData) {
47
48
  const areaNode = areaData[confid];
48
49
  if(!(areaNode && pens[areaNode.order])) return;
49
50
  const tagNode = pens[areaNode.order];
50
- tagNode.visible = !(node.id !== node.id);
51
+ tagNode.visible = !isActive;
51
52
  setElementSwitchTabState(tagNode);
52
53
  }
53
54
  }
@@ -34,18 +34,20 @@ export function mousMoveFun(type, pos, data) {
34
34
 
35
35
  for (var _i = 0, _a = data; _i < _a.length; _i++) {
36
36
  var item = _a[_i];
37
- //const isPoint = ptInPolyXY(pos, item.rotatedAnchors);
38
- let isInPointNode = null;
39
- if(item.name === 'arbitraryGraph') {
40
- // 任意多边形通过点获取区域
41
- isInPointNode = ptInPolyXY(pos, item.rotatedAnchors);
42
- }else {
43
- if(!(item instanceof Node)) item = new Node(item);
44
- isInPointNode = item.hit(pos);
45
- }
46
- if(isInPointNode) {
47
- params.hoverNode = item;
48
- params.order = _i;
37
+ if(item.visible) {
38
+ //const isPoint = ptInPolyXY(pos, item.rotatedAnchors);
39
+ let isInPointNode = null;
40
+ if(item.name === 'arbitraryGraph') {
41
+ // 任意多边形通过点获取区域
42
+ isInPointNode = ptInPolyXY(pos, item.rotatedAnchors);
43
+ }else {
44
+ if(!(item instanceof Node)) item = new Node(item);
45
+ isInPointNode = item.hit(pos);
46
+ }
47
+ if(isInPointNode) {
48
+ params.hoverNode = item;
49
+ params.order = _i;
50
+ }
49
51
  }
50
52
  }
51
53
  // 不在此节点上停留
@@ -63,6 +65,7 @@ export function mousMoveFun(type, pos, data) {
63
65
  }
64
66
  export function mousDownFun(type, eventNode) {
65
67
  let params = {};
68
+ if(eventNode === null) return params;
66
69
  const action = eventNode ? parseInt(eventNode.action) : 0;
67
70
  if(action === 3) {
68
71
  params.eventType = downDataType.Window; // 打开会话窗口
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dcim-topology2d",
3
- "version": "2.0.7",
3
+ "version": "2.0.8",
4
4
  "description": "",
5
5
  "main": "-",
6
6
  "scripts": {
@@ -140,21 +140,32 @@ export const echartsTypeMap = {
140
140
  };
141
141
  // 图表颜色
142
142
  export const echartsColorData = [
143
+ '#2648E9',
144
+ '#E513F7',
145
+ '#79E10E',
146
+ '#0D9BE7',
147
+ '#23CEE2',
148
+ '#E5B903',
149
+ '#2BDB8E',
150
+ '#CAD804',
151
+ '#117BEE',
152
+ '#DB8407',
153
+ '#E72B2B',
154
+ '#E96812',
155
+ '#7612D6',
156
+ '#A117B8',
157
+ 'rgb(21, 151, 224)',
143
158
  'rgb(36, 220, 132)',
144
159
  'rgb(154, 77, 251)',
145
160
  'rgb(226, 182, 56)',
146
161
  'rgb(253, 92, 71)',
147
- 'rgb(26, 117, 255)',
148
162
  'rgb(175, 215, 14)',
149
163
  'rgb(214, 154, 37)',
150
164
  'rgb(66, 251, 251)',
151
165
  'rgb(255, 158, 4)',
152
- 'rgb(30, 107, 222)',
153
- 'rgb(21, 151, 224)',
154
166
  'rgb(19, 236, 236)',
155
167
  'rgb(68, 237, 146)',
156
168
  'rgb(251, 94, 45)',
157
- 'rgb(18, 255, 113)',
158
169
  'rgb(18, 255, 113)'];
159
170
  // TOP排行榜默认颜色
160
171
  export const rankingTopColorList = [