dcim-topology2d 2.0.2 → 2.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/chart-diagram/index.d.ts +1 -1
- package/chart-diagram/index.js +1 -1
- package/chart-diagram/src/echarts/index.js +6 -6
- package/chart-diagram/src/register.js +2 -2
- package/chart-diagram/src/utils/changeOptions.d.ts +3 -0
- package/chart-diagram/src/utils/changeOptions.js +56 -0
- package/chart-diagram/src/utils/conversion.js +22 -37
- package/chart-diagram/src/utils/render.d.ts +1 -0
- package/chart-diagram/src/utils/render.js +17 -0
- package/core/src/common.js +81 -8
- package/core/src/core.js +58 -17
- package/core/src/divLayer.js +1 -1
- package/core/src/element/select.d.ts +2 -2
- package/core/src/element/select.js +92 -57
- package/core/src/element/tab.js +7 -10
- package/core/src/healps/changeData.js +20 -6
- package/core/src/middles/nodes/formselect.js +26 -12
- package/core/src/middles/nodes/iframe.js +5 -5
- package/core/src/models/pen.js +2 -50
- package/core/src/options.d.ts +1 -0
- package/core/src/options.js +2 -1
- package/core/src/preview.js +6 -1
- package/core/src/store/data.d.ts +70 -19
- package/core/src/store/data.js +88 -34
- package/core/src/utils/assignment.d.ts +1 -1
- package/core/src/utils/assignment.js +53 -23
- package/core/src/utils/construction.d.ts +2 -1
- package/core/src/utils/construction.js +2 -1
- package/core/src/utils/conversion.d.ts +1 -1
- package/core/src/utils/conversion.js +14 -20
- package/core/src/utils/onmousevent.d.ts +1 -1
- package/core/src/utils/onmousevent.js +4 -5
- package/core/src/utils/params.d.ts +2 -7
- package/core/src/utils/params.js +19 -87
- package/myShape-diagram/index.js +196 -0
- package/package.json +1 -1
- package/store/actions.js +1 -17
- package/store/clear.js +0 -62
- package/core/src/poll.js +0 -37
- package/myShape-diagram/myShape.js +0 -196
- /package/myShape-diagram/{myShape.ts → index.ts} +0 -0
@@ -1,17 +1,15 @@
|
|
1
|
-
import {
|
2
|
-
|
3
|
-
selectDataPool,
|
4
|
-
echartsRealDataPool,
|
5
|
-
echartsOptionsPool
|
6
|
-
} from "../../../store";
|
1
|
+
import {Store} from 'le5le-store';
|
2
|
+
import {commonStore} from "../store";
|
7
3
|
import { setMapDataOptions } from '../../../chart-diagram';
|
8
4
|
import {previewType, selectStaticType} from '../utils';
|
5
|
+
import {setElementSwitchTabState} from './tab';
|
9
6
|
let nodeId = '';
|
10
7
|
let downId = '';
|
11
8
|
// 创建下拉头
|
12
9
|
export function createSelectElement(node) {
|
13
10
|
const selectEle = document.createElement('div');
|
14
|
-
const
|
11
|
+
const order = node.formData.selected && node.formData.selected.order || 0;
|
12
|
+
const inputValue = commonStore[node.TID].selectDataPool[node.id].data[order] && commonStore[node.TID].selectDataPool[node.id].data[order].name;
|
15
13
|
let attrName = 'topology-select-icon-arrow';
|
16
14
|
if(node.selectDropdown) attrName += ' reverse';
|
17
15
|
const children = `<i class="${attrName}"
|
@@ -31,7 +29,7 @@ export function createSelectDropdown(node) {
|
|
31
29
|
const selectDropdownEle = document.createElement('div');
|
32
30
|
let liElements = '';
|
33
31
|
if(node.selectDropdown) {
|
34
|
-
liElements = createSelectOptions(selectDataPool[node.id].data, node);
|
32
|
+
liElements = createSelectOptions(commonStore[node.TID].selectDataPool[node.id].data, node);
|
35
33
|
selectDropdownEle.style.display = 'block';
|
36
34
|
setSelectDropdownPosition(node, selectDropdownEle);
|
37
35
|
}
|
@@ -44,7 +42,7 @@ export function createSelectDropdown(node) {
|
|
44
42
|
}
|
45
43
|
// 创建下拉options列表
|
46
44
|
export function createSelectOptions(data, node) {
|
47
|
-
const selectNode = selectDataPool[node.id];
|
45
|
+
const selectNode = commonStore[node.TID].selectDataPool[node.id];
|
48
46
|
const selectDropdownUl = selectNode.dom.selectDropdownUl;
|
49
47
|
if(selectDropdownUl) selectDropdownUl.innerHTML = '';
|
50
48
|
let leElement = '';
|
@@ -66,35 +64,43 @@ export function createSelectOptions(data, node) {
|
|
66
64
|
}
|
67
65
|
// 配置下拉头的交互状态:展开时三角图标向上,否则向下
|
68
66
|
export function setSelectInteractiveState(selected, node) {
|
69
|
-
const selectNode = selectDataPool[node.id];
|
67
|
+
const selectNode = commonStore[node.TID].selectDataPool[node.id];
|
70
68
|
selectNode.dom.selectIconArrow.style.display = selected ? 'none' : 'block';
|
71
69
|
//selectNode.dom['selectRemove'].style.display = selected ? 'block' : 'none';
|
72
70
|
}
|
73
71
|
// 重置下拉状态
|
74
72
|
export function resetSelectInteractiveState(node) {
|
75
|
-
|
76
|
-
|
73
|
+
const currentStore = commonStore[node.TID];
|
74
|
+
if(!Object.keys(currentStore.selectDataPool).length) return;
|
75
|
+
for (let data of Object.values(currentStore.selectDataPool)) {
|
77
76
|
if(node && node.id !== data.node.id) {
|
78
77
|
if(data.dom.selectIconArrow) data.dom.selectIconArrow.setAttribute('class', 'topology-select-icon-arrow');
|
79
78
|
data.slideState = false;
|
80
|
-
}
|
79
|
+
}
|
81
80
|
}
|
82
81
|
document.querySelector('.topology-select-dropdown').style.display = 'none';
|
83
|
-
elementInteractivePoor.node = null;
|
82
|
+
currentStore.elementInteractivePoor.node = null;
|
84
83
|
}
|
85
|
-
|
84
|
+
|
85
|
+
/**
|
86
|
+
* 配置下拉options容器的交互状态,展开和收起
|
87
|
+
* @param node 下拉元件节点数据
|
88
|
+
* @param staticType 下拉功能类型:1: 数据统计;2:数据展示;3:显示隐藏
|
89
|
+
* @param type 功能作用区域类型:Dcim,Topology,Logo
|
90
|
+
*/
|
86
91
|
export function setSelectDropdownInteractiveState(node, staticType, type) {
|
87
|
-
const
|
92
|
+
const currentStore = commonStore[node.TID];
|
93
|
+
const selectNode = currentStore.selectDataPool[node.id];
|
88
94
|
if(!selectNode.staticType) selectNode.staticType = staticType;
|
89
95
|
if(!selectNode) return;
|
90
96
|
if(downId !== node.id && type === previewType.Dcim) {
|
91
97
|
// 点击的不是同一个下拉则重置交互样式,清空数据
|
92
98
|
resetSelectInteractiveState(node);
|
93
|
-
elementInteractivePoor.options = null;
|
99
|
+
currentStore.elementInteractivePoor.options = null;
|
94
100
|
}
|
95
101
|
downId = node.id;
|
96
|
-
elementInteractivePoor.node = node;
|
97
|
-
selectElementStore(node.id);
|
102
|
+
currentStore.elementInteractivePoor.node = node;
|
103
|
+
selectElementStore(node.id, node.TID);
|
98
104
|
setSelectElementPosition(node);
|
99
105
|
const { selectIconArrow, selectDropdown } = selectNode.dom;
|
100
106
|
selectNode.slideState = !selectNode.slideState || node.selectDropdown; // 下拉展开状态
|
@@ -109,23 +115,23 @@ export function setSelectDropdownInteractiveState(node, staticType, type) {
|
|
109
115
|
// 图标旋转
|
110
116
|
selectIconArrow.setAttribute('class', attrName);
|
111
117
|
// 添加列表数据
|
112
|
-
if(!elementInteractivePoor.options) createSelectOptions(selectNode.data, node);
|
118
|
+
if(!currentStore.elementInteractivePoor.options) createSelectOptions(selectNode.data, node);
|
113
119
|
}
|
114
120
|
// 配置下拉偏移位置
|
115
121
|
export function setSelectElementPosition(node, type) {
|
116
122
|
// 不同元件切换
|
117
|
-
selectElementStore(node.id);
|
118
|
-
const selectNode = selectDataPool[node.id];
|
123
|
+
selectElementStore(node.id, node.TID);
|
124
|
+
const selectNode = commonStore[node.TID].selectDataPool[node.id];
|
119
125
|
if(type === 'down') {
|
120
126
|
if(nodeId === node.id) return;
|
121
|
-
elementInteractivePoor.options = null;
|
127
|
+
commonStore[node.TID].elementInteractivePoor.options = null;
|
122
128
|
createSelectOptions(selectNode.data, node);
|
123
129
|
}
|
124
130
|
nodeId = node.id;
|
125
131
|
setSelectDropdownPosition(node, selectNode.dom.selectDropdown);
|
126
132
|
}
|
127
133
|
function setSelectDropdownPosition(node, selectDropdown) {
|
128
|
-
const selectEle = selectDataPool[node.id].dom.selectEle;
|
134
|
+
const selectEle = commonStore[node.TID].selectDataPool[node.id].dom.selectEle;
|
129
135
|
let left = selectEle.getBoundingClientRect().left; // 获取下拉元素距离窗体左侧位置
|
130
136
|
let top = selectEle.getBoundingClientRect().top + node.rect.height;
|
131
137
|
if(window.location.pathname.includes('workspace')) {
|
@@ -139,57 +145,86 @@ function setSelectDropdownPosition(node, selectDropdown) {
|
|
139
145
|
const themeType = node.formData.theme ? ` theme${node.formData.theme}` : '';
|
140
146
|
selectDropdown.setAttribute('class', `topology-select-dropdown${themeType} documentDefine`);
|
141
147
|
}
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
148
|
+
|
149
|
+
/**
|
150
|
+
* 获取下拉选中的数据
|
151
|
+
* @param e 节点选中事件
|
152
|
+
* @param data 下拉元件节点数据
|
153
|
+
* @param editData 编辑显下拉的数据
|
154
|
+
*/
|
155
|
+
export function getSelectedData(e, data, editData) {
|
156
|
+
const currentStore = commonStore[data.TID];
|
157
|
+
const selectNode = currentStore.selectDataPool[data.id];
|
158
|
+
if(!currentStore.elementInteractivePoor.options && data.selectDropdown) currentStore.elementInteractivePoor.options = selectNode.dom.selectDropdownUl.querySelectorAll('.topology-select-dropdown-item');
|
159
|
+
let order = 0;
|
160
|
+
let staticType = selectNode.staticType;
|
161
|
+
if(!editData) {
|
162
|
+
const parentNode = e.target.parentNode;
|
163
|
+
const type = parentNode.getAttribute('type');
|
164
|
+
if(type !== 'option') return;
|
165
|
+
selectNode.slideState = false;
|
166
|
+
selectNode.dom.selectDropdown.style.display = 'none';
|
167
|
+
// 图标旋转
|
168
|
+
selectNode.dom.selectIconArrow.setAttribute('class', 'topology-select-icon-arrow');
|
149
169
|
// 选中节点操作
|
150
|
-
|
151
|
-
|
152
|
-
|
170
|
+
order = parentNode.getAttribute('data-order');
|
171
|
+
}else {
|
172
|
+
order = editData.order;
|
173
|
+
staticType = editData.staticType;
|
174
|
+
}
|
175
|
+
if(data.selectDropdown) {
|
176
|
+
for(let i = 0, leng = currentStore.elementInteractivePoor.options.length; i < leng; i++) {
|
153
177
|
let name = 'topology-select-dropdown-item';
|
154
178
|
if(i == order) {
|
155
179
|
name += ' selected';
|
156
180
|
}else {
|
157
181
|
name.replace(' selected', '');
|
158
182
|
}
|
159
|
-
elementInteractivePoor.options[i].setAttribute('class', name);
|
183
|
+
currentStore.elementInteractivePoor.options[i].setAttribute('class', name);
|
160
184
|
}
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
185
|
+
}
|
186
|
+
selectNode.optionOrder = order;
|
187
|
+
const node = selectNode.data[order];
|
188
|
+
selectNode.dom.selectEle.querySelector('.topology-select-input').value = node.name;
|
189
|
+
selectNode.node.selected = {
|
190
|
+
order: parseInt(order),
|
191
|
+
id: node.id
|
192
|
+
};
|
193
|
+
if(staticType === selectStaticType.static) {
|
194
|
+
// 数据统计
|
195
|
+
const optionNode = data.formData.bindBlockId && currentStore.echartsOptionsPool[data.formData.bindBlockId];
|
196
|
+
if(!optionNode) return;
|
197
|
+
// 切换数据
|
198
|
+
currentStore.echartsRealDataPool[optionNode.data.id] = currentStore.echartsRealDataPool[node.id];
|
199
|
+
setMapDataOptions(optionNode.option, optionNode.data);
|
200
|
+
}
|
201
|
+
if(staticType === selectStaticType.dataShow) {
|
202
|
+
// 数据展示
|
203
|
+
}
|
204
|
+
if(staticType === selectStaticType.visible) {
|
205
|
+
// 显示隐藏
|
206
|
+
const optionsVisibleData = currentStore.selectTabDataPool[data.id];
|
207
|
+
if(!optionsVisibleData || !optionsVisibleData.size) return;
|
208
|
+
for(const [key, value] of optionsVisibleData){
|
209
|
+
const eque = node.id === value.tag;
|
210
|
+
currentStore.data.pens[value.order].visible = eque;
|
211
|
+
currentStore.data.pens[value.order].visibleSwitch = eque;
|
212
|
+
value.visible = eque;
|
213
|
+
setElementSwitchTabState(value);
|
180
214
|
}
|
215
|
+
Store.set(`${data.TID}-LT:render`, true);
|
181
216
|
}
|
182
217
|
}
|
183
218
|
// 配置下拉展示的主题风格
|
184
219
|
export function setSelectElementTheme(node) {
|
185
220
|
const themeType = node.formData.theme ? ` theme${node.formData.theme}` : '';
|
186
|
-
const { selectEle, selectDropdown } = selectDataPool[node.id].dom;
|
221
|
+
const { selectEle, selectDropdown } = commonStore[node.TID].selectDataPool[node.id].dom;
|
187
222
|
selectEle.setAttribute('class', `topology-select${themeType}`);
|
188
223
|
selectDropdown.setAttribute('class', `topology-select-dropdown${themeType} documentDefine`);
|
189
224
|
}
|
190
225
|
// 存储下拉Dom节点
|
191
|
-
function selectElementStore(id) {
|
192
|
-
const selectNode = selectDataPool[id];
|
226
|
+
function selectElementStore(id, TID) {
|
227
|
+
const selectNode = commonStore[TID].selectDataPool[id];
|
193
228
|
if(!selectNode.dom.selectIconArrow) selectNode.dom.selectIconArrow = selectNode.dom.selectEle.querySelector('.topology-select-icon-arrow');
|
194
229
|
if(!selectNode.dom.selectDropdown) {
|
195
230
|
selectNode.dom.selectDropdown = document.querySelector('.topology-select-dropdown');
|
package/core/src/element/tab.js
CHANGED
@@ -1,17 +1,14 @@
|
|
1
|
-
import {
|
2
|
-
echartsDataPool,
|
3
|
-
elementInteractivePoor,
|
4
|
-
selectDataPool
|
5
|
-
} from '../../../store';
|
6
1
|
import {jsonLength} from '../utils';
|
2
|
+
import {commonStore} from "../store";
|
7
3
|
// 设置tab切换显示隐藏时的 Dom元件状态
|
8
4
|
export function setElementSwitchTabState(node) {
|
9
|
-
if(
|
10
|
-
|
5
|
+
if(node.name !== 'echarts' && (!node.children || !node.children.length)) return;
|
6
|
+
if(typeof commonStore[node.TID].elementInteractivePoor.elementDataLength !== 'number') {
|
7
|
+
commonStore[node.TID].elementInteractivePoor.elementDataLength = jsonLength(commonStore[node.TID].echartsDataPool) || jsonLength(commonStore[node.TID].selectDataPool);
|
11
8
|
}
|
12
|
-
if(!elementInteractivePoor.elementDataLength) return;
|
13
|
-
const ele = echartsDataPool[node.id] && echartsDataPool[node.id].div ||
|
14
|
-
selectDataPool[node.id] && selectDataPool[node.id].dom.selectEle;
|
9
|
+
if(!commonStore[node.TID].elementInteractivePoor.elementDataLength) return;
|
10
|
+
const ele = commonStore[node.TID].echartsDataPool[node.id] && commonStore[node.TID].echartsDataPool[node.id].div ||
|
11
|
+
commonStore[node.TID].selectDataPool[node.id] && commonStore[node.TID].selectDataPool[node.id].dom.selectEle;
|
15
12
|
if(ele) ele.style.display = !node.visible ? 'none': 'block';
|
16
13
|
if(node.children && node.children.length) {
|
17
14
|
node.children.map((ch) => {
|
@@ -1,10 +1,20 @@
|
|
1
1
|
//let DETAILDATA = null;
|
2
2
|
import {commonStore} from '../store';
|
3
|
-
import {echartsRealDataPool} from '../../../store';
|
4
3
|
import { getEchartsRealData } from '../utils/conversion';
|
5
4
|
export function setConfItemNode(pen, syn_synata) {
|
5
|
+
const entranceGuard = pen.events.find((ev) => {
|
6
|
+
return ev.value === 'entranceGuard';
|
7
|
+
});
|
8
|
+
if(entranceGuard) {
|
9
|
+
// 绑定门禁的元件实时数据
|
10
|
+
const nullUndefinedRegex = /^(?:null|undefined|\s*)$/;
|
11
|
+
const doorData = syn_synata.doorData && syn_synata.doorData[entranceGuard.params];
|
12
|
+
const doorState = doorData && !nullUndefinedRegex.test(doorData.state) && parseInt(doorData.state);
|
13
|
+
pen.text = doorState === 1 ? '开门' : '关门'; // 1-开门,其他值为关门
|
14
|
+
}
|
6
15
|
if (!pen.data) return;
|
7
16
|
if(commonStore[pen.TID]) commonStore[pen.TID].data.dataResize = 1;
|
17
|
+
let isAlarm = false; // 判断元件绑定的数据中是否有告警发生,用于九所项目服务器自身监控功能
|
8
18
|
if(pen.data instanceof Array) {
|
9
19
|
let _syn = null;
|
10
20
|
let isResetVal = false;
|
@@ -62,9 +72,11 @@ export function setConfItemNode(pen, syn_synata) {
|
|
62
72
|
switch (state) {
|
63
73
|
case 0: // 正常告警
|
64
74
|
color = '#FF0000';
|
75
|
+
isAlarm = true;
|
65
76
|
break;
|
66
77
|
case 1: // 离线告警, 通讯开关告警
|
67
78
|
color = '#6d6d6d';
|
79
|
+
isAlarm = true;
|
68
80
|
break;
|
69
81
|
case 2: // 未告警
|
70
82
|
case 3: // 无告警
|
@@ -94,18 +106,20 @@ export function setConfItemNode(pen, syn_synata) {
|
|
94
106
|
if (name === 'electricFan') setFanData(pen, _syn)
|
95
107
|
}else {
|
96
108
|
if (pen.elementRendered) pen.elementRendered = false;
|
97
|
-
if(pen.data.echarts) {
|
98
|
-
const {
|
109
|
+
if (pen.data.echarts) {
|
110
|
+
const {echartDataValue} = syn_synata;
|
99
111
|
const seriesData = echartDataValue;
|
100
112
|
const realData = pen.data.params && seriesData && Object.keys(seriesData).length && seriesData[pen.data.params.id];
|
101
113
|
if (Array.isArray(realData)) {
|
102
114
|
getEchartsRealData(pen, realData);
|
103
|
-
}else {
|
104
|
-
echartsRealDataPool[pen.id] = realData;
|
115
|
+
} else {
|
116
|
+
commonStore[pen.TID].echartsRealDataPool[pen.id] = realData;
|
105
117
|
}
|
106
118
|
}
|
107
119
|
}
|
108
|
-
return
|
120
|
+
return {
|
121
|
+
monitorAlarm: isAlarm
|
122
|
+
}
|
109
123
|
}
|
110
124
|
|
111
125
|
export function setNodeEvents(item, pen) {
|
@@ -5,43 +5,57 @@ import {
|
|
5
5
|
import {
|
6
6
|
setEventListener,
|
7
7
|
s8} from '../../utils';
|
8
|
-
import {echartsDataPool, selectDataPool, selectRealDataPool} from '../../../../store';
|
9
8
|
import {selectDefaultData} from '../../../../static';
|
9
|
+
import {commonStore} from "../../store";
|
10
10
|
|
11
11
|
export function formSelect(ctx, node) {
|
12
12
|
// 绘制一个底图,类似于占位符。
|
13
13
|
rectangle(ctx, node);
|
14
|
-
if (!selectDataPool[node.id]) {
|
14
|
+
if (!commonStore[node.TID].selectDataPool[node.id]) {
|
15
|
+
const currentStore = commonStore[node.TID];
|
15
16
|
node.elementId = s8();
|
16
17
|
node.dash = 4;
|
17
|
-
selectDataPool[node.id] = {
|
18
|
+
currentStore.selectDataPool[node.id] = {
|
18
19
|
slideState: node.selectDropdown,
|
19
20
|
node: {
|
20
21
|
id: node.id,
|
21
22
|
color: node.font.color,
|
22
23
|
fontSize: node.font.fontSize,
|
23
|
-
selected: null
|
24
|
+
selected: node.formData.selected || null
|
24
25
|
},
|
25
26
|
dom: {}
|
26
27
|
};
|
27
28
|
const bindBlockId = node.formData && node.formData.bindBlockId;
|
28
|
-
let selectRealData = bindBlockId && selectRealDataPool[bindBlockId];
|
29
|
+
let selectRealData = bindBlockId && currentStore.selectRealDataPool[bindBlockId];
|
29
30
|
if(bindBlockId && selectRealData) {
|
30
31
|
// select与echarts互相关联
|
31
|
-
selectDataPool[node.id].data = selectRealData;
|
32
|
-
const echartsData = echartsDataPool[bindBlockId];
|
32
|
+
currentStore.selectDataPool[node.id].data = selectRealData;
|
33
|
+
const echartsData = currentStore.echartsDataPool[bindBlockId];
|
33
34
|
if(echartsData){
|
34
35
|
echartsData.bindId = node.id;
|
35
36
|
}else {
|
36
|
-
echartsDataPool[bindBlockId] = {
|
37
|
+
currentStore.echartsDataPool[bindBlockId] = {
|
37
38
|
bindId: node.id
|
38
39
|
}
|
39
40
|
}
|
40
41
|
}else {
|
41
|
-
|
42
|
+
if(node.formData.ids) {
|
43
|
+
const optionIds = node.formData.ids.split(',');
|
44
|
+
const optionNames = node.formData.names.split(',');
|
45
|
+
const optionsData = [];
|
46
|
+
for (let i = 0; i < optionIds.length; i++) {
|
47
|
+
optionsData.push({
|
48
|
+
id: optionIds[i],
|
49
|
+
name: optionNames[i]
|
50
|
+
});
|
51
|
+
}
|
52
|
+
currentStore.selectDataPool[node.id].data = optionsData;
|
53
|
+
}else {
|
54
|
+
currentStore.selectDataPool[node.id].data = JSON.parse(JSON.stringify(selectDefaultData));
|
55
|
+
}
|
42
56
|
}
|
43
57
|
const select = createSelectElement(node);
|
44
|
-
selectDataPool[node.id].dom.selectEle = select;
|
58
|
+
currentStore.selectDataPool[node.id].dom.selectEle = select;
|
45
59
|
document.body.appendChild(select);
|
46
60
|
let selectDropdownEle = document.querySelector('.topology-select-dropdown');
|
47
61
|
if(!selectDropdownEle) {
|
@@ -50,13 +64,13 @@ export function formSelect(ctx, node) {
|
|
50
64
|
parentEle.appendChild(selectDropdownEle);
|
51
65
|
// 鼠标按下
|
52
66
|
selectDropdownEle.addEventListener('mousedown', (e) => {
|
53
|
-
setEventListener(e);
|
67
|
+
setEventListener(e, node.TID);
|
54
68
|
});
|
55
69
|
}
|
56
70
|
// 添加当前节点到div层
|
57
71
|
node.addToDiv();
|
58
72
|
}else {
|
59
|
-
const selectNode = selectDataPool[node.id];
|
73
|
+
const selectNode = commonStore[node.TID].selectDataPool[node.id];
|
60
74
|
if(selectNode.node.color === node.font.color && selectNode.node.fontSize === node.font.fontSize) return;
|
61
75
|
const selectDom = selectNode.dom;
|
62
76
|
if(!selectDom.selectInput) selectDom.selectInput = selectDom.selectEle.querySelector('.topology-select-input');
|
@@ -1,28 +1,28 @@
|
|
1
1
|
import {rectangle} from './rectangle';
|
2
|
-
import {iframeDataPool} from '../../../../store';
|
3
2
|
import {s8} from "../../utils";
|
4
3
|
import {createIframeElement} from "../../element";
|
4
|
+
import {commonStore} from "../../store";
|
5
5
|
|
6
6
|
export function iframePrimeval(ctx, node) {
|
7
7
|
//console.log('iframePrimeval############', node)
|
8
8
|
// 绘制一个底图,类似于占位符。
|
9
9
|
rectangle(ctx, node);
|
10
|
-
if (!iframeDataPool[node.id]) {
|
10
|
+
if (!commonStore[node.TID].iframeDataPool[node.id]) {
|
11
11
|
node.elementId = s8();
|
12
|
-
iframeDataPool[node.id] = {
|
12
|
+
commonStore[node.TID].iframeDataPool[node.id] = {
|
13
13
|
node: {
|
14
14
|
id: node.id,
|
15
15
|
src: node.iframe
|
16
16
|
}
|
17
17
|
};
|
18
18
|
const iframe = createIframeElement(node);
|
19
|
-
iframeDataPool[node.id].iframe = iframe;
|
19
|
+
commonStore[node.TID].iframeDataPool[node.id].iframe = iframe;
|
20
20
|
const parentEle = window.location.pathname.includes('workspace') ? document.getElementById('topology-canvas') : document.body;
|
21
21
|
parentEle.appendChild(iframe);
|
22
22
|
// 添加当前节点到div层
|
23
23
|
node.addToDiv();
|
24
24
|
}else {
|
25
|
-
const iframeNode = iframeDataPool[node.id];
|
25
|
+
const iframeNode = commonStore[node.TID].iframeDataPool[node.id];
|
26
26
|
if(iframeNode.node.src === node.iframe) return;
|
27
27
|
iframeNode.iframe.src = node.iframe;
|
28
28
|
}
|
package/core/src/models/pen.js
CHANGED
@@ -3,7 +3,6 @@ import { s8 } from '../utils/uuid';
|
|
3
3
|
import { Rect } from './rect';
|
4
4
|
import { pointInRect } from '../utils/canvas';
|
5
5
|
import { EventType, EventAction } from './event';
|
6
|
-
import { setConfItemNode } from '../healps/changeData';
|
7
6
|
export var PenType;
|
8
7
|
(function (PenType) {
|
9
8
|
PenType[PenType["Node"] = 0] = "Node";
|
@@ -108,6 +107,7 @@ var Pen = /** @class */ (function () {
|
|
108
107
|
this.tipId = json.tipId;
|
109
108
|
this.title = json.title;
|
110
109
|
this.visible = json.visible !== false;
|
110
|
+
this.visibleSwitch = !!json.visibleSwitch; // 元件显示隐藏的开关量
|
111
111
|
this.defaultFillStyle = json.defaultFillStyle || '';
|
112
112
|
this.defaultFontColor = json.defaultFontColor || '';
|
113
113
|
this.defaultStrokeStyle = json.defaultStrokeStyle || '';
|
@@ -131,7 +131,7 @@ var Pen = /** @class */ (function () {
|
|
131
131
|
}
|
132
132
|
}
|
133
133
|
Pen.prototype.render = function (ctx) {
|
134
|
-
if (!this.visible && !
|
134
|
+
if (!this.visible && !this.visibleSwitch){
|
135
135
|
return;
|
136
136
|
}
|
137
137
|
if (this.from && !this.to) {
|
@@ -248,54 +248,6 @@ var Pen = /** @class */ (function () {
|
|
248
248
|
this[this.eventFns[item.action]] && this[this.eventFns[item.action]](item.value, item.params);
|
249
249
|
}
|
250
250
|
};
|
251
|
-
Pen.prototype.doSocketMqtt = function (item, msg, client) {
|
252
|
-
if (item.action < EventAction.Function) {
|
253
|
-
this[this.eventFns[item.action]](msg.value || msg || item.value, msg.params || item.params, client);
|
254
|
-
}
|
255
|
-
else if (item.action < EventAction.SetProps) {
|
256
|
-
if (item.action === EventAction.Function && item.value) return this[this.eventFns[item.action]](item.value, msg || item.params, client);
|
257
|
-
let jsonNode = msg;
|
258
|
-
if (typeof msg === 'string') {
|
259
|
-
try {
|
260
|
-
jsonNode = JSON.parse(msg);
|
261
|
-
}catch (error) { }
|
262
|
-
}
|
263
|
-
console.log('doSocketMqtt-------------', jsonNode)
|
264
|
-
//const { areaData, assetData, data } = jsonNode
|
265
|
-
if (!this.data && this.data.length <= 0 && typeof this.data !== 'object') return
|
266
|
-
// const subscribeObj = {
|
267
|
-
// areaData, assetData, data,
|
268
|
-
// asset: ''
|
269
|
-
// }
|
270
|
-
jsonNode.asset = ''
|
271
|
-
Object.assign(this, setConfItemNode(this, jsonNode))
|
272
|
-
}
|
273
|
-
else if (item.action === EventAction.SetProps) {
|
274
|
-
var props = [];
|
275
|
-
var data = msg;
|
276
|
-
if (typeof msg === 'string') {
|
277
|
-
try {
|
278
|
-
data = JSON.parse(msg);
|
279
|
-
}
|
280
|
-
catch (error) { }
|
281
|
-
}
|
282
|
-
if (Array.isArray(data)) {
|
283
|
-
props = data;
|
284
|
-
}
|
285
|
-
for (var _i = 0, props_1 = props; _i < props_1.length; _i++) {
|
286
|
-
var prop = props_1[_i];
|
287
|
-
if (prop.key) {
|
288
|
-
if (typeof prop.value === 'object') {
|
289
|
-
this[prop.key] = Object.assign(this[prop.key], prop.value);
|
290
|
-
}
|
291
|
-
else {
|
292
|
-
this[prop.key] = prop.value;
|
293
|
-
}
|
294
|
-
}
|
295
|
-
}
|
296
|
-
Store.set(this.generateStoreKey('LT:render'), true);
|
297
|
-
}
|
298
|
-
};
|
299
251
|
Pen.prototype.show = function () {
|
300
252
|
this.visible = true;
|
301
253
|
return this;
|
package/core/src/options.d.ts
CHANGED
package/core/src/options.js
CHANGED
package/core/src/preview.js
CHANGED
@@ -239,7 +239,12 @@ var Preview = (function (_super) {
|
|
239
239
|
return;
|
240
240
|
// 1. 重置画布尺寸为容器尺寸
|
241
241
|
var parentElem = this.store.parentElem;
|
242
|
-
var width = parentElem.offsetWidth,
|
242
|
+
var width = parentElem.offsetWidth,
|
243
|
+
height = parentElem.offsetHeight;
|
244
|
+
if(this.store.options.storeSubscribe) {
|
245
|
+
width = this.store.options.width;
|
246
|
+
height = this.store.options.height;
|
247
|
+
}
|
243
248
|
this.canvasResize({
|
244
249
|
width: width,
|
245
250
|
height: height,
|