dcim-topology2d 2.0.8 → 3.0.2
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/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/index.d.ts +1 -3
- package/chart-diagram/index.js +1 -2
- package/chart-diagram/src/echarts/index.d.ts +2 -1
- package/chart-diagram/src/echarts/index.js +104 -109
- package/chart-diagram/src/register.js +8 -9
- 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 -2
- package/core/index.js +0 -2
- package/core/src/activeLayer.d.ts +10 -2
- package/core/src/activeLayer.js +47 -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 -43
- package/core/src/canvas.d.ts +6 -1
- package/core/src/canvas.js +21 -22
- package/core/src/common.d.ts +7 -6
- package/core/src/common.js +673 -332
- package/core/src/core.d.ts +4 -3
- package/core/src/core.js +367 -466
- package/core/src/divLayer.d.ts +36 -2
- package/core/src/divLayer.js +305 -33
- package/core/src/healps/changeData.d.ts +2 -1
- package/core/src/healps/changeData.js +66 -32
- package/core/src/hoverLayer.d.ts +9 -2
- package/core/src/hoverLayer.js +34 -31
- package/core/src/middles/default.d.ts +3 -1
- package/core/src/middles/default.js +51 -53
- package/core/src/middles/index.js +2 -3
- package/core/src/middles/nodes/arbitrarygraph.js +9 -11
- package/core/src/middles/nodes/pentagon.rect.js +1 -1
- package/core/src/middles/nodes/rectangle.rect.js +1 -1
- 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.d.ts +0 -10
- package/core/src/models/node.js +36 -69
- package/core/src/models/pen.js +59 -19
- package/core/src/models/rect.js +2 -2
- 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.d.ts +1 -3
- package/core/src/options.js +0 -2
- package/core/src/poll.js +39 -0
- package/core/src/preview.d.ts +13 -1
- package/core/src/preview.js +43 -111
- package/core/src/renderLayer.d.ts +9 -11
- package/core/src/renderLayer.js +61 -60
- 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/construction.d.ts +3 -12
- package/core/src/utils/construction.js +1 -8
- package/core/src/utils/conversion.d.ts +0 -11
- package/core/src/utils/conversion.js +0 -168
- package/core/src/utils/dom.d.ts +8 -0
- package/core/src/utils/dom.js +67 -0
- package/core/src/utils/dom.js.map +1 -0
- package/core/src/utils/index.d.ts +1 -2
- package/core/src/utils/index.js +1 -2
- package/core/src/utils/math.d.ts +0 -1
- package/core/src/utils/math.js +0 -3
- package/core/src/utils/onmousevent.d.ts +0 -3
- package/core/src/utils/onmousevent.js +10 -42
- 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/{index.js → myShape.js} +1 -4
- 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/chart-diagram/src/utils/changeOptions.d.ts +0 -7
- package/chart-diagram/src/utils/changeOptions.js +0 -261
- package/chart-diagram/src/utils/conversion.d.ts +0 -19
- package/chart-diagram/src/utils/conversion.js +0 -432
- package/chart-diagram/src/utils/drawGraphic.d.ts +0 -3
- package/chart-diagram/src/utils/drawGraphic.js +0 -97
- package/chart-diagram/src/utils/formatter.d.ts +0 -1
- package/chart-diagram/src/utils/formatter.js +0 -170
- package/chart-diagram/src/utils/index.d.ts +0 -4
- package/chart-diagram/src/utils/index.js +0 -4
- package/chart-diagram/src/utils/render.d.ts +0 -8
- package/chart-diagram/src/utils/render.js +0 -228
- package/core/src/element/common.d.ts +0 -5
- package/core/src/element/common.js +0 -54
- package/core/src/element/iframe.d.ts +0 -3
- package/core/src/element/iframe.js +0 -12
- package/core/src/element/index.d.ts +0 -4
- package/core/src/element/index.js +0 -4
- package/core/src/element/select.d.ts +0 -11
- package/core/src/element/select.js +0 -263
- package/core/src/element/tab.d.ts +0 -1
- package/core/src/element/tab.js +0 -23
- package/core/src/middles/arrows/index.d.ts +0 -4
- package/core/src/middles/arrows/index.js +0 -5
- package/core/src/middles/lines/index.d.ts +0 -4
- package/core/src/middles/lines/index.js +0 -5
- package/core/src/middles/nodes/formoverflow.js +0 -61
- package/core/src/middles/nodes/formselect.d.ts +0 -2
- package/core/src/middles/nodes/formselect.js +0 -95
- package/core/src/middles/nodes/iframe.d.ts +0 -2
- package/core/src/middles/nodes/iframe.js +0 -29
- package/core/src/middles/nodes/index.d.ts +0 -48
- package/core/src/middles/nodes/index.js +0 -49
- 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 -189
- package/core/src/store/data.js +0 -180
- package/core/src/store/index.d.ts +0 -2
- package/core/src/store/index.js +0 -2
- package/core/src/utils/assignment.d.ts +0 -6
- package/core/src/utils/assignment.js +0 -173
- package/core/src/utils/params.d.ts +0 -2
- package/core/src/utils/params.js +0 -60
- package/static/echartsDefaultData.js +0 -178
- package/static/element.js +0 -14
- package/static/form.js +0 -11
- package/static/index.js +0 -3
- package/store/actions.js +0 -1
- package/store/clear.js +0 -10
- package/store/index.js +0 -2
- package/style/common.css +0 -18
- package/style/editor.css +0 -13
- package/style/index.css +0 -4
- package/style/select.css +0 -143
- /package/myShape-diagram/{index.ts → myShape.ts} +0 -0
@@ -1,4 +1,3 @@
|
|
1
|
-
export const echartsStaticType = ['DAY', 'WEEK', 'MONTH', 'YEAR', 'REALTIME'];
|
2
1
|
export const winEventActionFns = ['Link', 'DoAnimate', 'DoFn', 'DoWindowFn', 'openImg'];
|
3
2
|
export const moveDataType = {
|
4
3
|
None: 0,
|
@@ -16,8 +15,7 @@ export const downDataType = {
|
|
16
15
|
Window: 'window',
|
17
16
|
Target: 'target',
|
18
17
|
Showhide: 'showhide',
|
19
|
-
Tabswitch: 'Tabswitch'
|
20
|
-
Formselect: 'Formselect'
|
18
|
+
Tabswitch: 'Tabswitch'
|
21
19
|
};
|
22
20
|
export const previewType = {
|
23
21
|
Dcim: 'dcim',
|
@@ -35,9 +33,4 @@ export const animateType = {
|
|
35
33
|
Error: 'error',
|
36
34
|
Show: 'show',
|
37
35
|
Rotate: 'rotate'
|
38
|
-
};
|
39
|
-
export const selectStaticType = {
|
40
|
-
static: 1,
|
41
|
-
dataShow: 2,
|
42
|
-
visible: 3
|
43
36
|
};
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import {Node} from "../models";
|
2
|
-
export declare function tabStaticOperation(type: string, node: Node, areaData: any, params: object): void;
|
3
|
-
export declare function tabHideShowOperation(node: any, areaData: any, visible: boolean): void;
|
4
|
-
export declare function getEchartsRealData(node: {}, data: []): void;
|
5
|
-
export declare function setInitConfData(id: string, data: object): void;
|
6
|
-
export declare function setTagIdData(data: any): [];
|
7
|
-
export declare function setKpiAddrData(data: any): [];
|
8
|
-
export declare function setAssetIdData(data: any): [];
|
9
|
-
export declare function setAreaIdData(data: any): [];
|
10
|
-
export declare function setVarValueData(data: any): [];
|
11
|
-
export declare function setThreeCategoryIdData(pen: Node, data: any): [];
|
@@ -1,168 +0,0 @@
|
|
1
|
-
import {commonStore} from '../store';
|
2
|
-
import {setElementSwitchTabState} from '../element';
|
3
|
-
import {echartsStaticType} from '../utils';
|
4
|
-
|
5
|
-
/**
|
6
|
-
* Tab 数据统计
|
7
|
-
* @param type 统计类型
|
8
|
-
* @param node 元件数据
|
9
|
-
* @param areaData tab展示区域数据
|
10
|
-
* @param params Tab 切换选中参数
|
11
|
-
*/
|
12
|
-
export function tabStaticOperation(type, node, areaData, params) {
|
13
|
-
if(!node.bindStaticId || !(echartsStaticType.includes(type) || type === 'OTHER')) return;
|
14
|
-
const curentEchart = areaData && areaData[node.bindStaticId]; // 获取当前点中的节点绑定的统计图表数据
|
15
|
-
if(!curentEchart || !curentEchart.data.params) return console.log('未能找到匹配的echarts图表>>>');
|
16
|
-
const currentStore = commonStore[node.TID];
|
17
|
-
const echartNode = currentStore.data.pens[curentEchart.order]; // 获取tab 绑定的图表元件数据
|
18
|
-
if(type === 'OTHER') {
|
19
|
-
const tabCorrelationType = currentStore.echartsDataPool[node.bindStaticId].tabCorrelationType; // 获取select与tab关联的标识
|
20
|
-
const optionNode = currentStore.echartsOptionsPool[node.bindStaticId];
|
21
|
-
if(tabCorrelationType === 'select') {
|
22
|
-
// tab类型为包含在select下的切换则执行下面的逻辑
|
23
|
-
echartNode.data.params['tabVisitOrder'] = params.order;
|
24
|
-
}else {
|
25
|
-
// 非 年、月、日、周、实时类型的切换
|
26
|
-
const groupData = currentStore.selectRealDataPool[node.bindStaticId];
|
27
|
-
if (optionNode) currentStore.echartsRealDataPool[optionNode.data.id] = currentStore.echartsRealDataPool[groupData[params.order].id];
|
28
|
-
}
|
29
|
-
if(optionNode) optionNode.data.tabData = {
|
30
|
-
type,
|
31
|
-
data: params.data
|
32
|
-
};
|
33
|
-
}
|
34
|
-
echartNode.data.params['staticForType'] = type
|
35
|
-
echartNode.elementRendered = false;
|
36
|
-
}
|
37
|
-
/**
|
38
|
-
* Tab 显示/隐藏切换
|
39
|
-
* @param node tab页签数据
|
40
|
-
* @param areaData // tab展示区域数据
|
41
|
-
* @param isActive
|
42
|
-
*/
|
43
|
-
export function tabHideShowOperation(node, areaData, isActive) {
|
44
|
-
const confIds = node.bindStaticId && node.bindStaticId.split(',') || [];
|
45
|
-
const pens = commonStore[node.TID].data.pens;
|
46
|
-
for (let i = 0; i < confIds.length; i++) {
|
47
|
-
const confid = confIds[i];
|
48
|
-
const areaNode = areaData[confid];
|
49
|
-
if(!(areaNode && pens[areaNode.order])) return;
|
50
|
-
const tagNode = pens[areaNode.order];
|
51
|
-
tagNode.visible = !isActive;
|
52
|
-
setElementSwitchTabState(tagNode);
|
53
|
-
}
|
54
|
-
}
|
55
|
-
/**
|
56
|
-
* 获取echarts和select实时数据
|
57
|
-
* @param node 节点
|
58
|
-
* @param data 实时数据
|
59
|
-
*/
|
60
|
-
export function getEchartsRealData(node, data){
|
61
|
-
const currentStore = commonStore[node.TID];
|
62
|
-
if(!currentStore.selectRealDataPool[node.id]) {
|
63
|
-
const selectData = [];
|
64
|
-
let currentData = null;
|
65
|
-
data.map((item, index) => {
|
66
|
-
if(index === 0) currentData = item;
|
67
|
-
selectData.push({
|
68
|
-
id: item.id,
|
69
|
-
name: item.aliasName
|
70
|
-
});
|
71
|
-
currentStore.echartsRealDataPool[item.id] = item;
|
72
|
-
});
|
73
|
-
currentStore.echartsRealDataPool[node.id] = currentData;
|
74
|
-
currentStore.selectRealDataPool[node.id] = selectData;
|
75
|
-
}else {
|
76
|
-
const selectId = currentStore.echartsDataPool[node.id] && currentStore.echartsDataPool[node.id].bindId;
|
77
|
-
const selected = selectId && currentStore.selectDataPool[selectId] && currentStore.selectDataPool[selectId].node.selected;
|
78
|
-
if(selected && selected.id) {
|
79
|
-
// 如有选中的数据
|
80
|
-
currentStore.echartsRealDataPool[node.id] = currentStore.echartsRealDataPool[selected.id];
|
81
|
-
}else {
|
82
|
-
currentStore.echartsRealDataPool[node.id] = data[0];
|
83
|
-
}
|
84
|
-
}
|
85
|
-
}
|
86
|
-
export function setInitConfData(id, data){
|
87
|
-
if(commonStore[id].initConfNode[data.id]) return;
|
88
|
-
const bindMqttNode = data.events.find((ev) => {return ev.type === 3});
|
89
|
-
if(!bindMqttNode) return;
|
90
|
-
const initNode = {
|
91
|
-
text: data.text,
|
92
|
-
font: data.font,
|
93
|
-
strokeStyle: data.strokeStyle,
|
94
|
-
fillStyle: data.fillStyle,
|
95
|
-
image: data.image,
|
96
|
-
leakageEnd: data.leakageEnd,
|
97
|
-
leakageFillStyle: data.leakageFillStyle,
|
98
|
-
leakageStart: data.leakageStart
|
99
|
-
}
|
100
|
-
if(data.name === 'echarts') initNode.data = data.data;
|
101
|
-
commonStore[id].initConfNode[data.id] = initNode;
|
102
|
-
}
|
103
|
-
export function setTagIdData(data) {
|
104
|
-
return [{
|
105
|
-
"key": "tagId",
|
106
|
-
"value": data.tagId,
|
107
|
-
"isControlDis": data.isControlDis,
|
108
|
-
"type": data.tagType,
|
109
|
-
"tagVal": data.value,
|
110
|
-
"valExplain": data.valExplain,
|
111
|
-
"tagId": data.tagId
|
112
|
-
}, {
|
113
|
-
"key": "测点名称",
|
114
|
-
"value": data.tagName
|
115
|
-
}];
|
116
|
-
}
|
117
|
-
export function setKpiAddrData(data) {
|
118
|
-
return [{
|
119
|
-
"key": "kpiAddr",
|
120
|
-
"value": data.kpiId + '_' + data.kpiAddr,
|
121
|
-
"isControlDis": data.isControlDis,
|
122
|
-
"type": data.tagType
|
123
|
-
}, {
|
124
|
-
"key": "指标名称",
|
125
|
-
"value": data.kpiName
|
126
|
-
}];
|
127
|
-
}
|
128
|
-
export function setAssetIdData(data) {
|
129
|
-
return [{
|
130
|
-
"key": "assetId",
|
131
|
-
"value": data.id
|
132
|
-
}, {
|
133
|
-
"key": "资产名称",
|
134
|
-
"value": data.name
|
135
|
-
}];
|
136
|
-
}
|
137
|
-
export function setAreaIdData(data) {
|
138
|
-
return [{
|
139
|
-
"key": "areaId",
|
140
|
-
"value": data.id
|
141
|
-
}, {
|
142
|
-
"key": "区域名称",
|
143
|
-
"value": data.name
|
144
|
-
}];
|
145
|
-
}
|
146
|
-
export function setVarValueData(data) {
|
147
|
-
return [{
|
148
|
-
"key": "varId",
|
149
|
-
"value": data.id
|
150
|
-
},{
|
151
|
-
"key": "varValue",
|
152
|
-
"value": data.value
|
153
|
-
}, {
|
154
|
-
"key": "变量类型名称",
|
155
|
-
"value": data.name
|
156
|
-
}];
|
157
|
-
}
|
158
|
-
export function setThreeCategoryIdData(pen, data) {
|
159
|
-
let params = [];
|
160
|
-
const hasThreeCategoryId = pen.data.find((tc) => {
|
161
|
-
return tc.key === 'threeCategoryId' && tc.value === data.threeCategoryId;
|
162
|
-
});
|
163
|
-
if(!hasThreeCategoryId) params = [{
|
164
|
-
"key": "threeCategoryId",
|
165
|
-
"value": data.threeCategoryId
|
166
|
-
}];
|
167
|
-
return params;
|
168
|
-
}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { Node } from '../models/node';
|
2
|
+
// @ts-ignore
|
3
|
+
import { TopologyData } from 'dcim-topology/core'
|
4
|
+
export declare let DomElements: {};
|
5
|
+
export declare function createChildrenDivByElementId(node: Node, data?: TopologyData): HTMLDivElement;
|
6
|
+
export declare function setStyleForElementIdDiv(node: Node, elem: HTMLElement, data: TopologyData): void;
|
7
|
+
export declare function createDiv(node: Node): HTMLDivElement;
|
8
|
+
export declare function loadJS(url: string, callback?: () => void, render?: boolean): void;
|
@@ -0,0 +1,67 @@
|
|
1
|
+
import { Store } from 'le5le-store';
|
2
|
+
import { Lock } from 'dcim-topology/core/src/models/status'
|
3
|
+
export let DomElements = {};
|
4
|
+
export function createChildrenDivByElementId(node, data) {
|
5
|
+
if (!DomElements[node.id]) {
|
6
|
+
DomElements[node.id] = document.getElementById(node.id);
|
7
|
+
if (DomElements[node.id]) {
|
8
|
+
document.querySelector('.canvas-point').appendChild(DomElements[node.id]);
|
9
|
+
}
|
10
|
+
}
|
11
|
+
setStyleForElementIdDiv(node, DomElements[node.id], data);
|
12
|
+
}
|
13
|
+
export function setStyleForElementIdDiv(node, elem, data) {
|
14
|
+
if (!elem) {
|
15
|
+
return;
|
16
|
+
}
|
17
|
+
elem.style.position = 'absolute';
|
18
|
+
elem.style.outline = 'none';
|
19
|
+
elem.style.left = node.rect.x + 'px';
|
20
|
+
elem.style.top = node.rect.y + 'px';
|
21
|
+
elem.style.width = node.rect.width + 'px';
|
22
|
+
elem.style.height = node.rect.height + 'px';
|
23
|
+
if (node.rotate || node.offsetRotate) {
|
24
|
+
elem.style.transform = "rotate(" + (node.rotate + node.offsetRotate) + "deg)";
|
25
|
+
}
|
26
|
+
// if (node.video && this.videos[node.id] && this.videos[node.id].media) {
|
27
|
+
// this.videos[node.id].media.style.width = '100%';
|
28
|
+
// this.videos[node.id].media.style.height = '100%';
|
29
|
+
// }
|
30
|
+
if (data && data.locked > Lock.None || node.locked > Lock.None) {
|
31
|
+
elem.style.userSelect = 'initial';
|
32
|
+
elem.style.pointerEvents = 'initial';
|
33
|
+
} else {
|
34
|
+
elem.style.userSelect = 'none';
|
35
|
+
elem.style.pointerEvents = 'none';
|
36
|
+
}
|
37
|
+
}
|
38
|
+
export function createDiv(node) {
|
39
|
+
var div = document.createElement('div');
|
40
|
+
div.style.position = 'absolute';
|
41
|
+
div.style.outline = 'none';
|
42
|
+
div.style.left = '-9999px';
|
43
|
+
div.style.bottom = '-9999px';
|
44
|
+
div.style.width = node.rect.width + 'px';
|
45
|
+
div.style.height = node.rect.height + 'px';
|
46
|
+
// if (node.elementId) {
|
47
|
+
// div.id = node.elementId;
|
48
|
+
// }
|
49
|
+
div.id = node.id;
|
50
|
+
return div;
|
51
|
+
}
|
52
|
+
export function loadJS(url, callback, render) {
|
53
|
+
var loaderScript = document.createElement('script');
|
54
|
+
loaderScript.type = 'text/javascript';
|
55
|
+
loaderScript.src = url;
|
56
|
+
loaderScript.addEventListener('load', function () {
|
57
|
+
if (callback) {
|
58
|
+
callback();
|
59
|
+
}
|
60
|
+
// how to do
|
61
|
+
if (render) {
|
62
|
+
Store.set('LT:render', true);
|
63
|
+
}
|
64
|
+
});
|
65
|
+
document.body.appendChild(loaderScript);
|
66
|
+
}
|
67
|
+
//# sourceMappingURL=dom.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"dom.js","sourceRoot":"","sources":["../../../../packages/core/src/utils/dom.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAIpC,MAAM,UAAU,SAAS,CAAC,IAAU;IAClC,IAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAC1C,GAAG,CAAC,KAAK,CAAC,QAAQ,GAAG,UAAU,CAAC;IAChC,GAAG,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;IAC3B,GAAG,CAAC,KAAK,CAAC,IAAI,GAAG,SAAS,CAAC;IAC3B,GAAG,CAAC,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC;IAC7B,GAAG,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACzC,GAAG,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;IAC3C,IAAI,IAAI,CAAC,SAAS,EAAE;QAClB,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC;KACzB;IAED,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,GAAW,EAAE,QAAqB,EAAE,MAAgB;IACzE,IAAM,YAAY,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IACtD,YAAY,CAAC,IAAI,GAAG,iBAAiB,CAAC;IACtC,YAAY,CAAC,GAAG,GAAG,GAAG,CAAC;IACvB,YAAY,CAAC,gBAAgB,CAAC,MAAM,EAAE;QACpC,IAAI,QAAQ,EAAE;YACZ,QAAQ,EAAE,CAAC;SACZ;QACD,YAAY;QACZ,IAAI,MAAM,EAAE;YACV,KAAK,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;SAC9B;IACH,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;AAC1C,CAAC"}
|
@@ -1,4 +1,5 @@
|
|
1
1
|
export * from './canvas';
|
2
|
+
export * from './dom';
|
2
3
|
export * from './math';
|
3
4
|
export * from './rect';
|
4
5
|
export * from './uuid';
|
@@ -6,5 +7,3 @@ export * from './padding'
|
|
6
7
|
export * from './construction';
|
7
8
|
export * from './onmousevent';
|
8
9
|
export * from './conversion';
|
9
|
-
export * from './assignment';
|
10
|
-
export * from './params';
|
package/core/src/utils/index.js
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
export * from './canvas';
|
2
|
+
export * from './dom';
|
2
3
|
export * from './math';
|
3
4
|
export * from './rect';
|
4
5
|
export * from './uuid';
|
@@ -6,6 +7,4 @@ export * from './padding'
|
|
6
7
|
export * from './construction';
|
7
8
|
export * from './onmousevent';
|
8
9
|
export * from './conversion';
|
9
|
-
export * from './assignment';
|
10
|
-
export * from './params';
|
11
10
|
//# sourceMappingURL=index.js.map
|
package/core/src/utils/math.d.ts
CHANGED
package/core/src/utils/math.js
CHANGED
@@ -1,6 +1,3 @@
|
|
1
|
-
import {Node} from '../models';
|
2
|
-
|
3
|
-
export declare function setEventListener(e: Event, TID: string, node: Node): any;
|
4
1
|
export declare function mousMoveFun(type: string, data: any): object;
|
5
2
|
export declare function mousDownFun(type: string, eventNode: object): object;
|
6
3
|
export declare function omouseEventPrototDoWindowFn(eventNode: object, node: object): string;
|
@@ -1,27 +1,11 @@
|
|
1
1
|
import { ptInPolyXY } from './math';
|
2
|
-
import { moveDataType, downDataType } from './construction'
|
3
|
-
import { Node } from '../models';
|
4
|
-
import {elementType} from "../../../static";
|
5
|
-
import {getSelectedData} from '../element';
|
6
|
-
import {commonStore} from "../store";
|
7
|
-
// 配置鼠标事件监听 监听样式 documentDefine
|
8
|
-
// 凡是类名为documentDefine的Dom元素都自动注册下面的监听
|
9
|
-
export function setEventListener(e, TID) {
|
10
|
-
e.preventDefault();
|
11
|
-
const documentDefine = document.querySelector('.documentDefine');
|
12
|
-
if(!documentDefine) return;
|
13
|
-
const currentNode = commonStore[TID].elementInteractivePoor.node; // 当前点击的元件节点数据
|
14
|
-
if(currentNode && currentNode.name === elementType.select) {
|
15
|
-
// select 下拉 option选中操作
|
16
|
-
getSelectedData(e, currentNode);
|
17
|
-
}
|
18
|
-
}
|
2
|
+
import { moveDataType, downDataType } from './construction'
|
19
3
|
// 执行window函数
|
20
4
|
export function omouseEventPrototDoWindowFn (eventNode, node) {
|
21
5
|
|
22
6
|
window[eventNode.value](node, eventNode.params);
|
23
7
|
|
24
|
-
}
|
8
|
+
};
|
25
9
|
export function mousMoveFun(type, pos, data) {
|
26
10
|
let params = {
|
27
11
|
order: 0,
|
@@ -34,20 +18,10 @@ export function mousMoveFun(type, pos, data) {
|
|
34
18
|
|
35
19
|
for (var _i = 0, _a = data; _i < _a.length; _i++) {
|
36
20
|
var item = _a[_i];
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
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
|
-
}
|
21
|
+
const isPoint = ptInPolyXY(pos, item.rotatedAnchors);
|
22
|
+
if(isPoint) {
|
23
|
+
params.hoverNode = item;
|
24
|
+
params.order = _i;
|
51
25
|
}
|
52
26
|
}
|
53
27
|
// 不在此节点上停留
|
@@ -65,21 +39,15 @@ export function mousMoveFun(type, pos, data) {
|
|
65
39
|
}
|
66
40
|
export function mousDownFun(type, eventNode) {
|
67
41
|
let params = {};
|
68
|
-
if(eventNode === null) return params;
|
69
42
|
const action = eventNode ? parseInt(eventNode.action) : 0;
|
70
43
|
if(action === 3) {
|
71
44
|
params.eventType = downDataType.Window; // 打开会话窗口
|
72
|
-
}else if(action === 7)
|
73
|
-
//
|
74
|
-
params.eventType = downDataType.Showhide;
|
45
|
+
}else if(action === 7){
|
46
|
+
params.eventType = downDataType.Showhide; // 链接跳转
|
75
47
|
params.value = eventNode.value;
|
76
|
-
}else if(action === 8)
|
48
|
+
}else if(action === 8){
|
77
49
|
params.eventType = downDataType.Tabswitch; // Tab切换
|
78
|
-
}else
|
79
|
-
params.eventType = downDataType.Formselect; // select下拉切换
|
80
|
-
params.staticType = eventNode.dcimStaticForType; // 1: 数据统计;2:数据展示;3:显示隐藏
|
81
|
-
}else {
|
82
|
-
// action === 5 远程控制比较特殊,无论是否绑定远程控制事件,只要数据中有远程控制属性且值为0都会认定为远程控制
|
50
|
+
} else {
|
83
51
|
params.eventType = downDataType.Target; // 链接跳转
|
84
52
|
}
|
85
53
|
return params;
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import { Node } from '
|
1
|
+
import { Node } from 'dcim-topology/core';
|
2
2
|
export declare function flowCommentAnchors(node: Node): void;
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import { Node } from '
|
1
|
+
import { Node } from 'dcim-topology/core';
|
2
2
|
export declare function flowComment(ctx: CanvasRenderingContext2D, node: Node): void;
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import { Node } from '
|
1
|
+
import { Node } from 'dcim-topology/core';
|
2
2
|
export declare function flowDataAnchors(node: Node): void;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Point, Direction } from '
|
1
|
+
import { Point, Direction } from 'dcim-topology/core';
|
2
2
|
export function flowDataAnchors(node) {
|
3
3
|
node.anchors.push(new Point(node.rect.x + node.rect.width / 14, node.rect.y + node.rect.height / 2, Direction.Left));
|
4
4
|
node.anchors.push(new Point(node.rect.x + (node.rect.width * 4) / 7, node.rect.y, Direction.Up));
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import { Node } from '
|
1
|
+
import { Node } from 'dcim-topology/core';
|
2
2
|
export declare function flowData(ctx: CanvasRenderingContext2D, node: Node): void;
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import { Node } from '
|
1
|
+
import { Node } from 'dcim-topology/core';
|
2
2
|
export declare function flowDb(ctx: CanvasRenderingContext2D, node: Node): void;
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import { Node } from '
|
1
|
+
import { Node } from 'dcim-topology/core';
|
2
2
|
export declare function flowDisplayAnchors(node: Node): void;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Point, Direction } from '
|
1
|
+
import { Point, Direction } from 'dcim-topology/core';
|
2
2
|
export function flowDisplayAnchors(node) {
|
3
3
|
node.anchors.push(new Point(node.rect.x, node.rect.y + node.rect.height / 2, Direction.Left));
|
4
4
|
node.anchors.push(new Point(node.rect.x + node.rect.width / 2, node.rect.y, Direction.Up));
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import { Node } from '
|
1
|
+
import { Node } from 'dcim-topology/core';
|
2
2
|
export declare function flowDisplay(ctx: CanvasRenderingContext2D, node: Node): void;
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import { Node } from '
|
1
|
+
import { Node } from 'dcim-topology/core';
|
2
2
|
export declare function flowDocumentAnchors(node: Node): void;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Point, Direction } from '
|
1
|
+
import { Point, Direction } from 'dcim-topology/core';
|
2
2
|
export function flowDocumentAnchors(node) {
|
3
3
|
node.anchors.push(new Point(node.rect.x, node.rect.y + node.rect.height / 2, Direction.Left));
|
4
4
|
node.anchors.push(new Point(node.rect.x + node.rect.width / 2, node.rect.y, Direction.Up));
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import { Node } from '
|
1
|
+
import { Node } from 'dcim-topology/core';
|
2
2
|
export declare function flowDocument(ctx: CanvasRenderingContext2D, node: Node): void;
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import { Node } from '
|
1
|
+
import { Node } from 'dcim-topology/core';
|
2
2
|
export declare function flowExternStorageAnchors(node: Node): void;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Point, Direction } from '
|
1
|
+
import { Point, Direction } from 'dcim-topology/core';
|
2
2
|
export function flowExternStorageAnchors(node) {
|
3
3
|
node.anchors.push(new Point(node.rect.x, node.rect.y + node.rect.height / 2, Direction.Left));
|
4
4
|
node.anchors.push(new Point(node.rect.x + (node.rect.width * 8) / 15, node.rect.y, Direction.Up));
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import { Node } from '
|
1
|
+
import { Node } from 'dcim-topology/core';
|
2
2
|
export declare function flowExternStorage(ctx: CanvasRenderingContext2D, node: Node): void;
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import { Node } from '
|
1
|
+
import { Node } from 'dcim-topology/core';
|
2
2
|
export declare function flowInternalStorage(ctx: CanvasRenderingContext2D, node: Node): void;
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import { Node } from '
|
1
|
+
import { Node } from 'dcim-topology/core';
|
2
2
|
export declare function flowManuallyAnchors(node: Node): void;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Point, Direction } from '
|
1
|
+
import { Point, Direction } from 'dcim-topology/core';
|
2
2
|
export function flowManuallyAnchors(node) {
|
3
3
|
node.anchors.push(new Point(node.rect.x, node.rect.y + (node.rect.height * 5) / 8, Direction.Left));
|
4
4
|
node.anchors.push(new Point(node.rect.x + node.rect.width / 2, node.rect.y + node.rect.height / 8, Direction.Up));
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import { Node } from '
|
1
|
+
import { Node } from 'dcim-topology/core';
|
2
2
|
export declare function flowManually(ctx: CanvasRenderingContext2D, node: Node): void;
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import { Node } from '
|
1
|
+
import { Node } from 'dcim-topology/core';
|
2
2
|
export declare function flowParallelAnchors(node: Node): void;
|