dcim-topology2d 2.0.8 → 2.1.0

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.
Files changed (46) hide show
  1. package/chart-diagram/src/utils/changeOptions.d.ts +1 -0
  2. package/chart-diagram/src/utils/changeOptions.js +41 -35
  3. package/chart-diagram/src/utils/conversion.js +140 -13
  4. package/chart-diagram/src/utils/formatter.d.ts +1 -1
  5. package/chart-diagram/src/utils/formatter.js +51 -15
  6. package/chart-diagram/src/utils/index.d.ts +1 -0
  7. package/chart-diagram/src/utils/index.js +1 -0
  8. package/chart-diagram/src/utils/render.js +43 -52
  9. package/chart-diagram/src/utils/surfaceParametricConversion.d.ts +3 -0
  10. package/chart-diagram/src/utils/surfaceParametricConversion.js +252 -0
  11. package/core/src/common.js +13 -5
  12. package/core/src/core.d.ts +2 -0
  13. package/core/src/core.js +61 -23
  14. package/core/src/element/common.d.ts +2 -1
  15. package/core/src/element/common.js +15 -15
  16. package/core/src/element/datePicker.d.ts +3 -0
  17. package/core/src/element/datePicker.js +47 -0
  18. package/core/src/element/index.d.ts +2 -1
  19. package/core/src/element/index.js +3 -1
  20. package/core/src/element/select.js +14 -2
  21. package/core/src/element/tab.js +8 -6
  22. package/core/src/element/time.d.ts +3 -0
  23. package/core/src/element/time.js +44 -0
  24. package/core/src/middles/default.js +8 -2
  25. package/core/src/middles/nodes/formDatePicker.d.ts +2 -0
  26. package/core/src/middles/nodes/formDatePicker.js +66 -0
  27. package/core/src/middles/nodes/formselect.js +7 -0
  28. package/core/src/middles/nodes/index.d.ts +3 -1
  29. package/core/src/middles/nodes/index.js +3 -0
  30. package/core/src/middles/nodes/time.d.ts +2 -0
  31. package/core/src/middles/nodes/time.js +98 -0
  32. package/core/src/models/node.js +12 -0
  33. package/core/src/preview.d.ts +1 -0
  34. package/core/src/preview.js +29 -5
  35. package/core/src/store/data.d.ts +5 -0
  36. package/core/src/store/data.js +9 -2
  37. package/core/src/utils/assignment.d.ts +2 -1
  38. package/core/src/utils/assignment.js +23 -11
  39. package/core/src/utils/conversion.d.ts +2 -0
  40. package/core/src/utils/conversion.js +43 -1
  41. package/core/src/utils/params.js +5 -0
  42. package/package.json +1 -1
  43. package/style/common.css +0 -3
  44. package/style/datePicker.css +44 -0
  45. package/style/editor.css +3 -0
  46. package/style/index.css +1 -0
@@ -5,19 +5,21 @@ export function setElementSwitchTabState(node) {
5
5
  if(node.children && node.children.length) {
6
6
  node.children.map((ch) => {
7
7
  ch.visible = node.visible;
8
+ ch.visibleSwitch = node.visible;
8
9
  setElementSwitchTabState(ch);
9
10
  })
10
11
  }
11
12
  if(!(node.name === 'echarts' || node.name === 'select')) return;
12
- if(typeof commonStore[node.TID].elementInteractivePoor.elementDataLength !== 'number') {
13
- commonStore[node.TID].elementInteractivePoor.elementDataLength = jsonLength(commonStore[node.TID].echartsDataPool) || jsonLength(commonStore[node.TID].selectDataPool);
13
+ const currentStore = commonStore[node.TID];
14
+ if(typeof currentStore.elementInteractivePoor.elementDataLength !== 'number') {
15
+ currentStore.elementInteractivePoor.elementDataLength = jsonLength(currentStore.echartsDataPool) || jsonLength(currentStore.selectDataPool);
14
16
  }
15
- if(!commonStore[node.TID].elementInteractivePoor.elementDataLength) return;
16
- const ele = commonStore[node.TID].echartsDataPool[node.id] && commonStore[node.TID].echartsDataPool[node.id].div ||
17
- commonStore[node.TID].selectDataPool[node.id] && commonStore[node.TID].selectDataPool[node.id].dom.selectEle;
17
+ if(!currentStore.elementInteractivePoor.elementDataLength) return;
18
+ const ele = currentStore.echartsDataPool[node.id] && currentStore.echartsDataPool[node.id].div ||
19
+ currentStore.selectDataPool[node.id] && currentStore.selectDataPool[node.id].dom.selectEle;
18
20
  if(ele) {
19
21
  ele.style.display = !node.visible ? 'none': 'block';
20
22
  }else {
21
- commonStore[node.TID].data.dataResize = 1;
23
+ currentStore.data.dataResize = 1;
22
24
  }
23
25
  }
@@ -0,0 +1,3 @@
1
+ import { Node } from '../models';
2
+
3
+ export declare function createTimeElement(node: Node): HTMLTimeElement;
@@ -0,0 +1,44 @@
1
+ // 创建时间组件
2
+ export function createTimeElement(node) {
3
+ const timeBox = document.createElement('div');
4
+ // timeBox.scrolling = 'no';
5
+ timeBox.width = node.rect.width;
6
+ timeBox.height = node.rect.height;
7
+ let children =
8
+ `<div class="timeWrapper" style="display: flex;flex-direction: initial; justify-content: center; font-size: ${node.font.fontSize}px;width:100%;height:100%; line-height:${timeBox.height}px; color:${node.font.color}; font-family:${node.font.fontFamily}">`+
9
+ `<div class="timeList" style="position: relative;display: flex; flex-direction: column;flex:4;height: 100%;overflow: hidden;text-align: center;">
10
+ <div class="timeBox" style="position: relative;width: 100%;height: 100%;overflow: hidden;">
11
+ <div class="timeTextUp h" style="position: relative;clip-path: polygon(0 0,100% 0,100% 49%,0 49%); background-color: rgba(255,255,255,0.1);border-radius: 20px;height: 100%;">${node.h}</div>
12
+ <div class="timeTextDown h" style="position: absolute;clip-path: polygon(0 51%,100% 51%,100% 100%,0 100%);left: 0;top: 0;width: 100%;height: 100%; background-color: rgba(255,255,255,0.1);border-radius: 20px;">${node.h}</div>
13
+ </div>
14
+ </div>`+
15
+ `<div class="split" style="flex:1; position: relative;line-height:${timeBox.height}px">:</div>`+
16
+ `<div class="timeList" style="position: relative;display: flex; flex-direction: column;flex:4;height: 100%;overflow: hidden;text-align: center;">
17
+ <div class="timeBox" style="position: relative;width: 100%;height: 100%;overflow: hidden;">
18
+ <div class="timeTextUp m" style="position: relative;clip-path: polygon(0 0,100% 0,100% 49%,0 49%); background-color: rgba(255,255,255,0.1);border-radius: 20px; height: 100%;">${node.m}</div>
19
+ <div class="timeTextDown m" style="position: absolute;clip-path: polygon(0 51%,100% 51%,100% 100%,0 100%);left: 0;top: 0;width: 100%;height: 100%; background-color: rgba(255,255,255,0.1);border-radius: 20px;">${node.m}</div>
20
+ </div>
21
+ </div>`+
22
+ `<div class="split" style="flex:1; position: relative;line-height:${timeBox.height}px">:</div>`+
23
+ `<div class="timeList" style="position: relative;display: flex; flex-direction: column;flex:4;height: 100%;overflow: hidden;text-align: center;">
24
+ <div class="timeBox" style="position: relative;width: 100%;height: 100%;overflow: hidden;">
25
+ <div class="timeTextUp s" style="position: relative;clip-path: polygon(0 0,100% 0,100% 49%,0 49%); background-color: rgba(255,255,255,0.1);border-radius: 20px; height: 100%;">${node.s}</div>
26
+ <div class="timeTextDown s" style="position: absolute;clip-path: polygon(0 51%,100% 51%,100% 100%,0 100%);left: 0;top: 0;width: 100%;height: 100%; background-color: rgba(255,255,255,0.1);border-radius: 20px;">${node.s}</div>
27
+ </div>
28
+ </div>`+
29
+ `</div>`
30
+ timeBox.setAttribute('id', node.id);
31
+ timeBox.setAttribute('class', 'topology2dConfTime');
32
+ timeBox.innerHTML = children;
33
+ return timeBox;
34
+ }
35
+ export function updateTimeStyle(node, time) {
36
+ time.querySelector('.timeWrapper').style.lineHeight = node.rect.height+'px';
37
+ time.querySelector('.timeWrapper').style.fontSize = node.font.fontSize+'px';
38
+ time.querySelector('.timeWrapper').style.fontFamily = node.font.fontFamily;
39
+ time.querySelector('.timeWrapper').style.color = node.font.color;
40
+ time.querySelectorAll('.split').forEach(element => {
41
+ element.style.lineHeight = node.rect.height+'px';
42
+ });
43
+
44
+ }
@@ -5,7 +5,7 @@ import {
5
5
  twowayArrow, twowayArrowIconRect, twowayArrowTextRect,
6
6
  rectangle, rectangleIconRect, rectangleTextRect,
7
7
  diamond, diamondIconRect, diamondTextRect,
8
- text, file, formtable, tablePagination, iframePrimeval,formSelect,
8
+ text, file, formtable, tablePagination, iframePrimeval,formSelect, fromDatePicker,
9
9
  line as nodeLine, lineAnchors, lineIconRect, lineTextRect,
10
10
  circle, circleIconRect, circleTextRect, circleAnchors,
11
11
  triangle, triangleIconRect, triangleTextRect, triangleAnchors,
@@ -17,7 +17,7 @@ import {
17
17
  imageIconRect, imageTextRect,
18
18
  cube, cubeAnchors, cubeIconRect, cubeTextRect,
19
19
  people, peopleIconRect, peopleTextRect,
20
- arbitraryGraph, arbitraryGraphAnchors,
20
+ arbitraryGraph, arbitraryGraphAnchors,time
21
21
  } from './nodes';
22
22
  import {
23
23
  line,
@@ -62,6 +62,8 @@ export var drawArrowFns = {};
62
62
  function init() {
63
63
  console.log('Init middles.');
64
64
  // ********Default nodes.*******
65
+ // datePicker
66
+ drawNodeFns.datePicker = fromDatePicker;
65
67
  // select
66
68
  drawNodeFns.select = formSelect;
67
69
  // iframe
@@ -199,6 +201,10 @@ function init() {
199
201
  drawArrowFns.lineUp = lineUp;
200
202
  drawArrowFns.lineDown = lineDown;
201
203
  // ********end********
204
+ // 当前时间
205
+ drawNodeFns.time = time;
206
+ iconRectFns.time = rectangleIconRect;
207
+ textRectFns.time = rectangleTextRect;
202
208
  }
203
209
  init();
204
210
  // registerNode: Register a custom node.
@@ -0,0 +1,2 @@
1
+ import { Node } from '../../models';
2
+ export declare function fromDatePicker(ctx: CanvasRenderingContext2D, node: Node): void;
@@ -0,0 +1,66 @@
1
+ import {Store} from 'le5le-store';
2
+ import {rectangle} from './rectangle';
3
+ import { createDatePickerElement, loadJS, setDataPickerElementStyle } from '../../element';
4
+ import { s8 } from '../../utils';
5
+ import {commonStore} from "../../store";
6
+
7
+ export async function fromDatePicker(ctx, node) {
8
+ // 绘制一个底图,类似于占位符。
9
+ rectangle(ctx, node);
10
+
11
+ if (!window.datePickerRegister) {
12
+ //未注册datePicker插件
13
+ const datePickerRegisterData = await loadJS(`${window.location.origin}/libary/laydate/laydate.js`).catch((e) => {
14
+ console.error('datePicker插件加载失败>>>', e);
15
+ });
16
+ if(!datePickerRegisterData) return;
17
+ }
18
+
19
+ const currentStore = commonStore[node.TID];
20
+
21
+ if (!currentStore.pickerDataPool[node.id]) {
22
+ // 未创建该元件
23
+ node.elementId = s8();
24
+ const datePicker = createDatePickerElement(node);
25
+ currentStore.pickerDataPool[node.id] = {
26
+ dom: {
27
+ container: datePicker
28
+ }
29
+ }
30
+ document.body.appendChild(datePicker);
31
+ // 添加当前节点到div层
32
+ node.addToDiv();
33
+ setDataPickerElementStyle(node);
34
+ if(window.location.pathname.includes('workspace') && currentStore.options.type === 'topology') return;
35
+ const pickerOptions = Object.keys(node.pickerOptions).reduce((a,k) => (node.pickerOptions[k] && (a[k]=node.pickerOptions[k]), a), {}); // 过滤空数据
36
+ if((pickerOptions.min || pickerOptions.max) && (pickerOptions.type !== 'year' || pickerOptions.type !== 'month')){
37
+ // 字符转换
38
+ if(pickerOptions.min && isValidInteger(pickerOptions.min)) pickerOptions.min = Number(pickerOptions.min);
39
+ if(pickerOptions.max && isValidInteger(pickerOptions.max)) pickerOptions.max = Number(pickerOptions.max);
40
+ }
41
+ pickerOptions.elem = `#picker${node.id}`;
42
+ pickerOptions.done = function (val, date) {
43
+ node.formData.selected = val
44
+ date.value = val;
45
+ Store.set(`${node.TID}-EVENT:change`, {node, date});
46
+ }
47
+ setTimeout(() => {
48
+
49
+ laydate.render(pickerOptions);
50
+
51
+ }, 100)
52
+ }else {
53
+ if(node.formData.resetStyle) {
54
+ setDataPickerElementStyle(node);
55
+ node.formData.resetStyle = false;
56
+ }
57
+ // if(!node.formData.render) return;
58
+ // node.formData.render = false;
59
+ // const pickerOptions = Object.keys(node.pickerOptions).reduce((a,k) => (node.pickerOptions[k] && (a[k]=node.pickerOptions[k]), a), {}); // 过滤空数据
60
+ // Object.assign(node.formData.datePicker.config, pickerOptions);
61
+ //resetDatePicker(node);
62
+ }
63
+ }
64
+ function isValidInteger(str) {
65
+ return /^-?\d+$/.test(str) && str !== '-' && !str.startsWith('+');
66
+ }
@@ -38,7 +38,14 @@ export function formSelect(ctx, node) {
38
38
  let selectRealData = bindBlockId && currentStore.selectRealDataPool[bindBlockId];
39
39
  if(bindBlockId && selectRealData) {
40
40
  // select与echarts互相关联
41
+ if(node.formData.ids) {
42
+ const optionIds = node.formData.ids.split(',');
43
+ for (let i = 0; i < optionIds.length; i++) {
44
+ if(selectRealData[i]) selectRealData[i].optionId = optionIds[i];
45
+ }
46
+ }
41
47
  currentStore.selectDataPool[node.id].data = selectRealData;
48
+ currentStore.selectDataPool[node.id].node.selected.id = selectRealData[0].id;
42
49
  const echartsData = currentStore.echartsDataPool[bindBlockId];
43
50
  echartsData ? echartsData.bindId = node.id : currentStore.echartsDataPool[bindBlockId] = {
44
51
  bindId: node.id
@@ -45,4 +45,6 @@ export * from './text';
45
45
  export * from './triangle';
46
46
  export * from './triangle.anchor';
47
47
  export * from './triangle.rect';
48
- export * from './formoverflow';
48
+ export * from './formoverflow';
49
+ export * from './time';
50
+ export * from './formDatePicker';
@@ -46,4 +46,7 @@ export * from './triangle';
46
46
  export * from './triangle.anchor';
47
47
  export * from './triangle.rect';
48
48
  export * from './formoverflow';
49
+ export * from './time';
50
+ export * from './formDatePicker';
51
+
49
52
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,2 @@
1
+ import { Node } from '../../models';
2
+ export declare function time(ctx: CanvasRenderingContext2D, node: Node): void;
@@ -0,0 +1,98 @@
1
+ export function time(ctx, node) {
2
+ var wr = node.borderRadius;
3
+ var hr = node.borderRadius;
4
+ if (node.borderRadius < 1) {
5
+ wr = node.rect.width * node.borderRadius;
6
+ hr = node.rect.height * node.borderRadius;
7
+ }
8
+ var r = wr < hr ? wr : hr;
9
+ if (node.rect.width < 2 * r) {
10
+ r = node.rect.width / 2;
11
+ }
12
+ if (node.rect.height < 2 * r) {
13
+ r = node.rect.height / 2;
14
+ }
15
+
16
+ // 背景
17
+ let x = node.rect.x;
18
+ let y = node.rect.y;
19
+ let width = node.rect.width * 0.29;
20
+ let height = node.rect.height;
21
+ let gap = node.rect.width * 0.065;
22
+ let {h, m, s} = node.time;
23
+
24
+ //绘制时
25
+ drawText(ctx, r, x, y, width, height, h, node, gap)
26
+
27
+ //绘制分
28
+ drawText(ctx, r, x+width+gap, y, width, height, m, node, gap)
29
+
30
+ //绘制秒
31
+ drawText(ctx, r, x+(width*2 + gap*2), y, width, height, s, node)
32
+
33
+ //恢复填充色
34
+ ctx.fillStyle = "#ffffff";
35
+
36
+
37
+ }
38
+
39
+ function drawText(ctx, r, x, y, width, height, hText, node, gap) {
40
+
41
+ //文字
42
+ let textfillStyle = node.font.color || "#ffffff";
43
+ let textBackground = node.font.background || '#ffffff1a';
44
+ ctx.font = '' + node.font.fontSize +"px " + node.font.fontFamily;
45
+ ctx.textBaseline = 'middle';
46
+ ctx.textAlign = 'center';
47
+
48
+ const centerX = width / 2;
49
+ const centerY = height / 2;
50
+ //绘制上半部分
51
+ ctx.save();
52
+ ctx.beginPath();
53
+ ctx.fillStyle = textBackground;
54
+ ctx.beginPath();
55
+ ctx.moveTo(x + r, y);
56
+ ctx.lineTo(x + width -r, y);
57
+ ctx.quadraticCurveTo(x + width, y, x+width, y+r);
58
+ ctx.lineTo(x+width, y + height/2 - 1);
59
+ ctx.lineTo(x, y + height/2 - 1);
60
+ ctx.lineTo(x, y+r);
61
+ ctx.quadraticCurveTo(x, y, x+r, y);
62
+ ctx.fill();
63
+ ctx.clip();
64
+
65
+ ctx.fillStyle = textfillStyle;
66
+ ctx.fillText(hText, x+centerX, y+centerY);
67
+ ctx.restore();
68
+ //绘制下半部分
69
+ ctx.save();
70
+ ctx.beginPath();
71
+ ctx.fillStyle = textBackground;
72
+ ctx.moveTo(x, y+height/2+1);
73
+ ctx.lineTo(x+width, y+height/2+1);
74
+ ctx.lineTo(x+width, y+height-r);
75
+ ctx.quadraticCurveTo(x+width, y+height, x+width-r, y+height);
76
+ ctx.lineTo(x+r, y+height);
77
+ ctx.quadraticCurveTo(x, y+height, x, y+height-r);
78
+ ctx.lineTo(x, y+height/2+2);
79
+ ctx.fill();
80
+ ctx.clip();
81
+
82
+ ctx.fillStyle = textfillStyle;
83
+ ctx.fillText(hText, x+centerX, y+centerY);
84
+ ctx.restore();
85
+
86
+ //绘制冒号
87
+ if(!gap) return
88
+
89
+ ctx.fillStyle = textfillStyle;
90
+ ctx.textBaseline = 'middle';
91
+ ctx.textAlign = 'center';
92
+ let metricss = ctx.measureText(":");
93
+ const fontHeights = metricss.actualBoundingBoxAscent + metricss.actualBoundingBoxDescent;
94
+ const centerYY = y + (height / 2) + (metricss.actualBoundingBoxAscent - fontHeights / 2);
95
+ ctx.fillText(":", x+width+(gap/2), centerYY);
96
+ ctx.restore();
97
+
98
+ }
@@ -57,6 +57,7 @@ var Node = /** @class */ (function (_super) {
57
57
  };
58
58
  _this.floorImageIndex = json.floorImageIndex || false;
59
59
  _this.formData = json.formData || null;
60
+ _this.pickerOptions = json.pickerOptions || null;
60
61
  _this.formStyle = json.formStyle || null;
61
62
  _this.formEvents = json.formEvents || [];
62
63
  _this.paginationData = json.paginationData || null;
@@ -144,6 +145,7 @@ var Node = /** @class */ (function (_super) {
144
145
  _this.video = json.video;
145
146
  _this.play = json.play;
146
147
  _this.nextPlay = json.nextPlay;
148
+ _this.time = json.time;
147
149
  if (json.elementLoaded !== undefined) {
148
150
  _this.elementId = null;
149
151
  _this.elementLoaded = false;
@@ -172,6 +174,16 @@ var Node = /** @class */ (function (_super) {
172
174
  _this.children = null;
173
175
  }
174
176
 
177
+ if(json.name === 'time') {
178
+ _this.animateFn = function() {
179
+ let date = new Date();
180
+ var hour = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
181
+ var minute = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
182
+ var second = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
183
+ _this.time = {h: hour, m:minute, s:second}
184
+ }
185
+ }
186
+
175
187
  return _this;
176
188
  }
177
189
  Node.cloneState = function (json) {
@@ -4,6 +4,7 @@ import { Point } from './models';
4
4
  import {Common} from './common';
5
5
  export declare class Preview extends Common{
6
6
  constructor(parent: string | HTMLElement, options?: Options);
7
+ private eventChangeSubcribe;
7
8
  private scheduledAnimationFrame;
8
9
  private onMouseMove;
9
10
  private onmousedown;
@@ -35,6 +35,14 @@ var Preview = (function (_super) {
35
35
  var _this = _super.call(this, parent, options) || this;
36
36
  _this.offscreen.getRoutineLayer(['AnimateLayer']);
37
37
  _this.scheduledAnimationFrame = false;
38
+ _this.innerHeight = window.innerHeight || document.documentElement.clientHeight; // 初始化网页高度
39
+ _this.devicePixelInnerHeight = _this.innerHeight; // 初始化网页缩放高度
40
+ _this.devicePixelRatio = window.devicePixelRatio; // 初始化窗口分辨率
41
+ // 选中值发生变化时触发,目前用于日期切换
42
+ _this.eventChangeSubcribe = Store.subscribe(this.generateStoreKey('EVENT:change'), function (data) {
43
+ const {node, date} = data;
44
+ _this.dispatch('change', node, date); // eventOut外部事件
45
+ });
38
46
  _this.onMouseMove = function (e) {
39
47
  _this.store.data.dataResize = 0;
40
48
  // https://caniuse.com/#feat=mdn-api_mouseevent_buttons
@@ -181,14 +189,29 @@ var Preview = (function (_super) {
181
189
  return false;
182
190
  };
183
191
  window.onresize = function () {
184
- const isFullScreen = document.fullscreenElement || document.webkitFullscreenElement || document.mozFullscreenElement;
185
- if(!isFullScreen && _this.isFullScreen){
186
- _this.moveIn.hoverNode.text = '全屏';
192
+ let isFullScreen = document.fullscreenElement || document.webkitFullscreenElement || document.mozFullscreenElement;
193
+ if((!isFullScreen && _this.isFullScreen) || window.keyControlFullScreen){
194
+ // F11或ESC退出全屏
195
+ if(!window.keyControlFullScreen) _this.moveIn.hoverNode.text = '全屏';
187
196
  _this.fitViewPreview(_this.isFullScreen);
188
197
  _this.isFullScreen = false;
198
+ window.keyControlFullScreen = false;
189
199
  }else {
190
- // pageZoomOnly 表示topology页面只全局缩放,不对局部缩放进行调整,不执行render重绘。通常用于无任何操作事件的topology驾驶舱
191
- if(_this.store.options.type === 'topology' || _this.store.options.type === 'pageZoomOnly') return;
200
+ const documentElementHeight = window.innerHeight || document.documentElement.clientHeight; // 每次窗口有变化就重新获取一次网页高度
201
+ if(window.devicePixelRatio !== _this.devicePixelRatio) {
202
+ _this.devicePixelInnerHeight = documentElementHeight;
203
+ _this.devicePixelRatio = window.devicePixelRatio;
204
+ }
205
+ if(_this.devicePixelInnerHeight < documentElementHeight && !isFullScreen) {
206
+ // 按F11 全屏
207
+ setTimeout(() => {
208
+ _this.fitViewPreview(false);
209
+ _this.isFullScreen = true;
210
+ }, 200);
211
+ window.keyControlFullScreen = true;
212
+ }
213
+ // topology编辑器或全屏下跳出程序
214
+ if(_this.store.options.type === 'topology' || window.keyControlFullScreen) return;
192
215
  const screenWidth = window.screen.width < 1920 ? 1920 : window.screen.width;
193
216
  const zoom = window.innerWidth < screenWidth ? document.documentElement.clientWidth / screenWidth : 1;
194
217
  _this.isResize = true;
@@ -303,6 +326,7 @@ var Preview = (function (_super) {
303
326
  };
304
327
  Preview.prototype.destroy = function () {
305
328
  this.destroyStatic();
329
+ if(this.eventChangeSubcribe) this.eventChangeSubcribe.unsubscribe();
306
330
  this.onMouseMove = null;
307
331
  this.onmousedown = null;
308
332
  this.onmouseup = null;
@@ -38,6 +38,7 @@ export interface paramsData {
38
38
  assetIds?: [],
39
39
  areaIds?: [],
40
40
  varVaule?: [],
41
+ branchValue?: [],
41
42
  echartData?: [],
42
43
  echartAssemblyData?: [],
43
44
  routingkey?: string,
@@ -56,6 +57,7 @@ export interface visualization2DStore {
56
57
  data: visualization2DData;
57
58
  }[];
58
59
  elementInteractivePoor: {}; // element 交互过渡数据
60
+ pickerDataPool: {}; // datePicker 交互数据池
59
61
  echartsDataPool: {}; // echarts Dom节点数据
60
62
  echartsOptionsPool: {}; // echarts options节点数据
61
63
  echartsRealDataPool: {}; // echarts 实时数据
@@ -102,6 +104,7 @@ export const createStore = () => {
102
104
  assetIds: [],
103
105
  areaIds: [],
104
106
  varVaule: [],
107
+ branchValue: [],
105
108
  echartData: [],
106
109
  echartAssemblyData: [],
107
110
  routingkey: '',
@@ -110,6 +113,7 @@ export const createStore = () => {
110
113
  pens: {},
111
114
  options: { ...DefalutOptions },
112
115
  elementInteractivePoor: {}, // element 交互过渡数据
116
+ pickerDataPool: {}, // datePicker 交互数据池
113
117
  echartsDataPool: {}, // echarts Dom节点数据
114
118
  echartsOptionsPool: {}, // echarts options节点数据
115
119
  echartsRealDataPool: {}, // echarts 实时数据
@@ -174,6 +178,7 @@ export const clearStore = (store: visualization2DStore, del: string) => {
174
178
  assetIds: [],
175
179
  areaIds: [],
176
180
  varVaule: [],
181
+ branchValue: [],
177
182
  echartData: [],
178
183
  echartAssemblyData: [],
179
184
  routingkey: '',
@@ -44,6 +44,7 @@ export var createStore = function () {
44
44
  assetIds: [],
45
45
  areaIds: [],
46
46
  varVaule: [],
47
+ branchValue: [],
47
48
  echartData: [],
48
49
  echartAssemblyData: [],
49
50
  routingkey: '',
@@ -52,9 +53,10 @@ export var createStore = function () {
52
53
  pens: {},
53
54
  options: { ...DefalutOptions },
54
55
  elementInteractivePoor: {}, // element 交互过渡数据
56
+ pickerDataPool: {}, // datePicker 交互数据池
55
57
  echartsDataPool: {}, // echarts Dom节点数据
56
58
  echartsOptionsPool: {}, // echarts options节点数据
57
- echartsRealDataPool: {}, // echarts 实时数据
59
+ echartsRealDataPool: {}, // echarts 实时数据 datePicker
58
60
  switchTabDataPool: {}, // tabs
59
61
  tableDataPool: {}, // form table
60
62
  selectDataPool: {}, // form select
@@ -68,7 +70,8 @@ export var createStore = function () {
68
70
  dpiRatio: 1,
69
71
  lastScale: 1,
70
72
  monitorAlarm: false,// 全局报警标记,代表正在访问的这个topology文件中是否有告警发生
71
- parentElem: null
73
+ parentElem: null,
74
+ timeDataPool: {}, // time
72
75
  };
73
76
  };
74
77
  export var useStore = function (id) {
@@ -87,6 +90,7 @@ export function clearElementDataPool(data) {
87
90
  if(node.chart) {
88
91
  node.chart.off('mouseover');
89
92
  node.chart.off('mouseout');
93
+ node.chart.off('globalout');
90
94
  node.chart.dispose();
91
95
  }
92
96
  if(node.div && node.div.parentNode) node.div.parentNode.removeChild(node.div);
@@ -149,6 +153,7 @@ export var clearStore = function (store, del) {
149
153
  assetIds: [],
150
154
  areaIds: [],
151
155
  varVaule: [],
156
+ branchValue: [],
152
157
  echartData: [],
153
158
  echartAssemblyData: [],
154
159
  routingkey: '',
@@ -160,6 +165,7 @@ export var clearStore = function (store, del) {
160
165
  store.lastScale = 1;
161
166
  store.monitorAlarm = false;
162
167
  store.elementInteractivePoor = {};
168
+ store.pickerDataPool = {};
163
169
  store.echartsOptionsPool = {};
164
170
  store.echartsRealDataPool = {};
165
171
  store.switchTabDataPool = {};
@@ -172,6 +178,7 @@ export var clearStore = function (store, del) {
172
178
  iframeDataPool: store.iframeDataPool,
173
179
  formoverDataPool: store.formoverDataPool,
174
180
  formoverCanvasDataPool: store.formoverCanvasDataPool,
181
+ timeDataPool: store.timeDataPool
175
182
  });
176
183
  if(del) {
177
184
  delete commonStore[store.id];
@@ -3,4 +3,5 @@ import {Node} from '../models';
3
3
  export declare function setInitNodeDataValidat(node: any, TID: string, type: string, order: number): void;
4
4
  export declare function initDefaultValidat(node: any, retData: any): void;
5
5
  export declare function setDefaultNodeValidat(node: any, retData: any): any;
6
- export declare function setConnectionTagForConf(node: Node): void;
6
+ export declare function setConnectionTagForConf(node: Node): void;
7
+ export declare function setConnectionTabsData(node: Node): void;
@@ -47,14 +47,15 @@ export function initDefaultValidat(node, retData) {
47
47
  if (node.name === 'line') {
48
48
  node.defaultStrokeStyle = node.strokeStyle;
49
49
  }
50
+ const dataDictionary = retData && {...retData.varData, ...retData.branchNameData} || {};
50
51
  // 变量类型数据展示,不需要实时更新
51
- if(Array.isArray(node.data) && retData && retData.varData) {
52
+ if(Array.isArray(node.data) && Object.keys(dataDictionary).length) {
52
53
  let typeName = '';
53
54
  let imgs = '';
54
- const varData = retData.varData;
55
+ const assetId = retData.asset && retData.asset.assetId;
55
56
  node.data.map((vd) => {
56
- if(vd.key.includes('varValue') && varData[vd.value]){
57
- const varNode = varData[vd.value];
57
+ const varNode = dataDictionary[vd.value] || dataDictionary[`${assetId}_${vd.value}`];
58
+ if((vd.key.includes('varValue') || vd.key.includes('branchVal')) && varNode){
58
59
  const showType = varNode.showType ? parseInt(varNode.showType) : 1;
59
60
  if(showType === 1 && varNode.value) typeName += typeName ? `,${varNode.value}` : varNode.value;
60
61
  if(showType === 2 && varNode.value) console.log('显示图标>>>');
@@ -142,15 +143,10 @@ export function setConnectionTagForConf(node) {
142
143
  if(t === 'statisticType' || t.includes('switchTabType')) setType = 'tab';
143
144
  if(t.includes('selectOption')) setType = 'selectShow';
144
145
  });
145
- const isTabs = node.events && node.events.find((ev) => ev.action === 8);
146
- if(!setType && isTabs) console.log('>>>未能找到绑定的标签数据,请检查绑定的Tabs标签是否包含switchTabType前缀>>>');
146
+ if(!setType) console.log('>>>未能找到绑定的标签数据,请检查绑定的Tabs标签是否包含switchTabType前缀>>>');
147
147
  if(setType === 'tab'){
148
148
  // tab切换
149
- const tagData = node.tags[0];
150
- let topologyChangeData = commonStore[node.TID].switchTabDataPool;
151
- let keyName = node.bindStaticId ? `${tagData}Data` : `${tagData}AreaData`;
152
- if (!topologyChangeData[keyName]) topologyChangeData[keyName] = {};
153
- topologyChangeData[keyName][node.id] = node;
149
+ setConnectionTabsData(node);
154
150
  }
155
151
  if(setType === 'selectShow'){
156
152
  // 下拉显示隐藏
@@ -170,4 +166,20 @@ export function setConnectionTagForConf(node) {
170
166
  commonStore[node.TID].selectTabDataPool[parentId].set(node.id, params);
171
167
  }
172
168
  }
169
+ }
170
+
171
+ /**
172
+ * 初始化配置tabs数据
173
+ * @param node
174
+ */
175
+ export function setConnectionTabsData(node) {
176
+ const switchTabType = node.tags.find((t) => {
177
+ return t.includes('switchTabType');
178
+ }); // 获取按钮组类型
179
+ if(!switchTabType) return;
180
+ const isTabs = node.events && node.events.find((ev) => ev.action === 8);
181
+ let topologyChangeData = commonStore[node.TID].switchTabDataPool;
182
+ let keyName = node.bindStaticId && isTabs ? `${switchTabType}Data` : `${switchTabType}AreaData`;
183
+ if (!topologyChangeData[keyName]) topologyChangeData[keyName] = {};
184
+ topologyChangeData[keyName][node.id] = node;
173
185
  }
@@ -1,4 +1,5 @@
1
1
  import {Node} from "../models";
2
+ export declare function getTabConnectSHConf(node: Node): Node;
2
3
  export declare function tabStaticOperation(type: string, node: Node, areaData: any, params: object): void;
3
4
  export declare function tabHideShowOperation(node: any, areaData: any, visible: boolean): void;
4
5
  export declare function getEchartsRealData(node: {}, data: []): void;
@@ -8,4 +9,5 @@ export declare function setKpiAddrData(data: any): [];
8
9
  export declare function setAssetIdData(data: any): [];
9
10
  export declare function setAreaIdData(data: any): [];
10
11
  export declare function setVarValueData(data: any): [];
12
+ export declare function setBranchAddressData(data: any): [];
11
13
  export declare function setThreeCategoryIdData(pen: Node, data: any): [];