dcim-topology2d 1.1.6 → 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 +88 -96
- package/chart-diagram/src/register.js +3 -3
- package/chart-diagram/src/utils/changeOptions.d.ts +7 -4
- package/chart-diagram/src/utils/changeOptions.js +228 -144
- package/chart-diagram/src/utils/conversion.d.ts +12 -12
- package/chart-diagram/src/utils/conversion.js +263 -137
- package/chart-diagram/src/utils/render.d.ts +6 -0
- package/chart-diagram/src/utils/render.js +124 -0
- package/core/index.d.ts +1 -0
- package/core/index.js +1 -0
- package/core/src/activeLayer.js +0 -6
- package/core/src/canvas.js +1 -0
- package/core/src/common.d.ts +1 -2
- package/core/src/common.js +197 -541
- package/core/src/core.js +116 -60
- package/core/src/divLayer.d.ts +0 -3
- package/core/src/divLayer.js +13 -34
- package/core/src/element/common.d.ts +5 -0
- package/core/src/element/common.js +52 -0
- package/core/src/element/iframe.d.ts +3 -0
- package/core/src/element/iframe.js +12 -0
- package/core/src/element/index.d.ts +4 -0
- package/core/src/element/index.js +4 -0
- package/core/src/element/select.d.ts +11 -0
- package/core/src/element/select.js +234 -0
- package/core/src/element/tab.d.ts +1 -0
- package/core/src/element/tab.js +19 -0
- package/core/src/healps/changeData.d.ts +1 -2
- package/core/src/healps/changeData.js +33 -125
- package/core/src/middles/default.js +3 -1
- package/core/src/middles/nodes/arbitrarygraph.js +11 -9
- package/core/src/middles/nodes/formselect.d.ts +2 -0
- package/core/src/middles/nodes/formselect.js +87 -0
- package/core/src/middles/nodes/iframe.js +21 -4
- package/core/src/middles/nodes/index.d.ts +1 -0
- package/core/src/middles/nodes/index.js +1 -0
- package/core/src/models/node.d.ts +4 -0
- package/core/src/models/node.js +24 -22
- package/core/src/models/pen.js +3 -52
- package/core/src/models/rect.js +2 -2
- package/core/src/options.d.ts +2 -0
- package/core/src/options.js +2 -1
- package/core/src/preview.js +51 -32
- package/core/src/renderLayer.d.ts +10 -6
- package/core/src/renderLayer.js +36 -43
- package/core/src/store/data.d.ts +71 -21
- package/core/src/store/data.js +93 -17
- package/core/src/utils/assignment.d.ts +6 -3
- package/core/src/utils/assignment.js +120 -21
- package/core/src/utils/construction.d.ts +10 -3
- package/core/src/utils/construction.js +7 -1
- package/core/src/utils/conversion.d.ts +3 -0
- package/core/src/utils/conversion.js +62 -1
- package/core/src/utils/index.d.ts +1 -1
- package/core/src/utils/index.js +1 -1
- package/core/src/utils/math.d.ts +1 -0
- package/core/src/utils/math.js +3 -0
- package/core/src/utils/onmousevent.d.ts +3 -0
- package/core/src/utils/onmousevent.js +27 -7
- package/core/src/utils/params.d.ts +2 -0
- package/core/src/utils/params.js +57 -0
- package/myShape-diagram/index.js +196 -0
- package/package.json +1 -1
- package/static/echartsDefaultData.js +27 -107
- package/static/element.js +14 -0
- package/static/form.js +11 -0
- package/static/index.js +2 -1
- package/store/actions.js +1 -0
- package/store/clear.js +10 -0
- package/store/index.js +2 -0
- package/style/common.css +18 -0
- package/style/editor.css +13 -0
- package/style/index.css +3 -12
- package/style/select.css +143 -0
- package/core/src/poll.js +0 -37
- package/core/src/utils/dom.d.ts +0 -9
- package/core/src/utils/dom.js +0 -103
- package/core/src/utils/dom.js.map +0 -1
- package/myShape-diagram/myShape.js +0 -196
- package/static/echartsStore.js +0 -14
- /package/myShape-diagram/{myShape.ts → index.ts} +0 -0
package/core/src/core.js
CHANGED
@@ -18,8 +18,20 @@ import {ActiveLayer} from './activeLayer';
|
|
18
18
|
import {KeyType, KeydownType} from './options';
|
19
19
|
import {PenType, Node, Point, Line, Lock, AnchorMode, Rect} from './models';
|
20
20
|
import {drawNodeFns, drawLineFns} from './middles/index';
|
21
|
-
import {
|
22
|
-
|
21
|
+
import {
|
22
|
+
s8,
|
23
|
+
pointInRect,
|
24
|
+
formatPadding,
|
25
|
+
setTagIdData,
|
26
|
+
setKpiAddrData,
|
27
|
+
setAssetIdData,
|
28
|
+
setAreaIdData,
|
29
|
+
setVarValueData,
|
30
|
+
setThreeCategoryIdData,
|
31
|
+
setConnectionTagForConf
|
32
|
+
} from './utils';
|
33
|
+
import {setSelectElementPosition} from './element';
|
34
|
+
import {elementType} from '../../static';
|
23
35
|
|
24
36
|
var resizeCursors = ['nw-resize', 'ne-resize', 'se-resize', 'sw-resize'];
|
25
37
|
var dockOffset = 10;
|
@@ -195,6 +207,12 @@ var Topology = (function (_super) {
|
|
195
207
|
_this.activeLayer.move(offset.x ? offset.x : x, offset.y ? offset.y : y);
|
196
208
|
_this.needCache = true;
|
197
209
|
}
|
210
|
+
const dropdownSelect = _this.activeLayer.pens.filter((ds) => {return ds.name === elementType.select && ds.selectDropdown});
|
211
|
+
if(dropdownSelect.length) {
|
212
|
+
dropdownSelect.map((dropdown) => {
|
213
|
+
setSelectElementPosition(dropdown);
|
214
|
+
})
|
215
|
+
}
|
198
216
|
break;
|
199
217
|
case _this.moveInType.ResizeCP:
|
200
218
|
_this.store.data.dataResize = 1;
|
@@ -245,8 +263,11 @@ var Topology = (function (_super) {
|
|
245
263
|
}
|
246
264
|
}
|
247
265
|
} else {
|
266
|
+
const activeLayerPens = _this.activeLayer.pens;
|
267
|
+
const isOnlySelect = activeLayerPens.length < 2 && activeLayerPens[0].name === elementType.select && activeLayerPens[0].selectDropdown;
|
268
|
+
if(isOnlySelect) setSelectElementPosition(activeLayerPens[0]);
|
248
269
|
_this.activeLayer.resize(_this.moveIn.activeAnchorIndex, _this.mouseDown, pos);
|
249
|
-
_this.dispatch('resizePens',
|
270
|
+
_this.dispatch('resizePens', activeLayerPens);
|
250
271
|
_this.needCache = true;
|
251
272
|
}
|
252
273
|
break;
|
@@ -444,9 +465,8 @@ var Topology = (function (_super) {
|
|
444
465
|
const activeNode = _this.moveIn.activeNode;
|
445
466
|
if (!_this.checkNodeOfClickType(activeNode)) {
|
446
467
|
_this.activeLayer.setPens([activeNode]);
|
447
|
-
if
|
448
|
-
|
449
|
-
} else if (activeNode && activeNode.name == 'tablePagination') {
|
468
|
+
if(activeNode.name === elementType.select && activeNode.selectDropdown) setSelectElementPosition(activeNode, 'down');
|
469
|
+
if(activeNode.name == 'tablePagination') {
|
450
470
|
if (_this.store.options.type === 'topology') return _this.dispatch('node', activeNode);
|
451
471
|
const pnlKeys = Object.keys(activeNode.paginationData.pageNumberLocals);
|
452
472
|
const pageNumArea = pnlKeys.find((pna) => {
|
@@ -460,16 +480,8 @@ var Topology = (function (_super) {
|
|
460
480
|
if (activeNode.paginationData.pageListState) _this.spreadPageListHandle(activeNode, e);
|
461
481
|
if (activeNode.paginationData.targetPageLocal.hide) _this.targetPageInputHandle(activeNode, e);
|
462
482
|
}
|
463
|
-
}
|
483
|
+
}else {
|
464
484
|
_this.dispatch('node', activeNode);
|
465
|
-
if(!window.location.pathname.includes('workspace')) {
|
466
|
-
const staticTypeNode = activeNode.events.find((ev) => {
|
467
|
-
return parseInt(ev.action) === 8
|
468
|
-
}); // 若绑定的是echarts统计图事件
|
469
|
-
if (staticTypeNode) {
|
470
|
-
_this.switchStaticsCheckType(activeNode, staticTypeNode);
|
471
|
-
}
|
472
|
-
}
|
473
485
|
}
|
474
486
|
}
|
475
487
|
}
|
@@ -987,8 +999,10 @@ var Topology = (function (_super) {
|
|
987
999
|
if (this.store.data.scale !== 1) {
|
988
1000
|
node.scale(this.store.data.scale);
|
989
1001
|
}
|
1002
|
+
node.visibleSwitch = true;
|
1003
|
+
node.order = this.store.data.pens.length;
|
990
1004
|
this.store.data.pens.push(node);
|
991
|
-
|
1005
|
+
setConnectionTagForConf(node);
|
992
1006
|
if (focus) {
|
993
1007
|
this.render();
|
994
1008
|
this.animate(true);
|
@@ -1093,7 +1107,7 @@ var Topology = (function (_super) {
|
|
1093
1107
|
}
|
1094
1108
|
}
|
1095
1109
|
}
|
1096
|
-
// In active pen.
|
1110
|
+
// In active pen.
|
1097
1111
|
if (!this.store.data.locked) {
|
1098
1112
|
for (var _i = 0, _a = this.activeLayer.pens; _i < _a.length; _i++) {
|
1099
1113
|
var item = _a[_i];
|
@@ -1118,13 +1132,15 @@ var Topology = (function (_super) {
|
|
1118
1132
|
this.divLayer.canvas.style.cursor = 'default';
|
1119
1133
|
var len = this.store.data.pens.length;
|
1120
1134
|
for (var i = len - 1; i > -1; --i) {
|
1121
|
-
if
|
1122
|
-
|
1123
|
-
|
1124
|
-
|
1125
|
-
|
1126
|
-
|
1127
|
-
|
1135
|
+
if(this.store.data.pens[i].visible || this.store.data.pens[i].visibleSwitch){
|
1136
|
+
if (this.store.data.pens[i].type === PenType.Node &&
|
1137
|
+
this.inNode(pt, this.store.data.pens[i])) {
|
1138
|
+
return;
|
1139
|
+
} else if (this.store.data.pens[i].type === PenType.Line &&
|
1140
|
+
this.inLine(pt, this.store.data.pens[i])) {
|
1141
|
+
// 需要优先判断十分在节点锚点上
|
1142
|
+
// return;
|
1143
|
+
}
|
1128
1144
|
}
|
1129
1145
|
}
|
1130
1146
|
};
|
@@ -1564,7 +1580,7 @@ var Topology = (function (_super) {
|
|
1564
1580
|
this.delEmptyLines(pen.id);
|
1565
1581
|
}
|
1566
1582
|
pens.push.apply(pens, this.store.data.pens.splice(found, 1));
|
1567
|
-
this.setSwitchTabData(pen, found, 'delete');
|
1583
|
+
// this.setSwitchTabData(pen, found, 'delete');
|
1568
1584
|
--i;
|
1569
1585
|
}
|
1570
1586
|
this.animateLayer.pens.delete(pen.id);
|
@@ -1694,9 +1710,10 @@ var Topology = (function (_super) {
|
|
1694
1710
|
}
|
1695
1711
|
pen.controlPoints = controlPoints;
|
1696
1712
|
}
|
1713
|
+
pen.order = this.store.data.pens.length;
|
1697
1714
|
this.store.data.pens.push(pen);
|
1698
1715
|
this.activeLayer.add(pen);
|
1699
|
-
|
1716
|
+
setConnectionTagForConf(pen);
|
1700
1717
|
}
|
1701
1718
|
this.render();
|
1702
1719
|
this.animate(true);
|
@@ -1720,8 +1737,8 @@ var Topology = (function (_super) {
|
|
1720
1737
|
};
|
1721
1738
|
for (var _i = 0, _a = this.activeLayer.pens; _i < _a.length; _i++) {
|
1722
1739
|
var pen = _a[_i];
|
1723
|
-
pen.data = []
|
1724
|
-
this.bindInfo(item, pen, dataType, index)
|
1740
|
+
pen.data = [];
|
1741
|
+
this.bindInfo(item, pen, dataType, index);
|
1725
1742
|
this.clipboard.pens.push(pen.clone());
|
1726
1743
|
}
|
1727
1744
|
if (exite == true) {
|
@@ -1729,22 +1746,23 @@ var Topology = (function (_super) {
|
|
1729
1746
|
}
|
1730
1747
|
};
|
1731
1748
|
Topology.prototype.bindInfo = async function (item, pen, type, index) {
|
1749
|
+
const itemNode = item && item.default || item;
|
1732
1750
|
if ([0, '0'].includes(type)) {
|
1733
|
-
const setTagId = setTagIdData(
|
1751
|
+
const setTagId = setTagIdData(itemNode);
|
1734
1752
|
pen.data.push(...setTagId);
|
1735
1753
|
// 绑定悬浮文字
|
1736
|
-
pen.title =
|
1754
|
+
pen.title = itemNode.touchpname
|
1737
1755
|
//用于处理场地监控,点击一个资产类别后,隐藏掉这个类别下的所有元件
|
1738
|
-
const setThreeCategory = setThreeCategoryIdData(pen,
|
1756
|
+
const setThreeCategory = setThreeCategoryIdData(pen, itemNode);
|
1739
1757
|
pen.data.push(...setThreeCategory);
|
1740
1758
|
} else if ([1, '1'].includes(type)) {
|
1741
|
-
const setKpiAddr = setKpiAddrData(
|
1759
|
+
const setKpiAddr = setKpiAddrData(itemNode);
|
1742
1760
|
pen.data.push(...setKpiAddr);
|
1743
1761
|
} else if ([2, '2'].includes(type)) {
|
1744
|
-
const setAssetId = setAssetIdData(
|
1762
|
+
const setAssetId = setAssetIdData(itemNode);
|
1745
1763
|
pen.data.push(...setAssetId);
|
1746
1764
|
// 绑定悬浮文字
|
1747
|
-
pen.title =
|
1765
|
+
pen.title = itemNode.bak
|
1748
1766
|
if (pen.subName && pen.subName == 'temp') {
|
1749
1767
|
// 温湿度元件
|
1750
1768
|
// 通讯状态
|
@@ -1752,23 +1770,19 @@ var Topology = (function (_super) {
|
|
1752
1770
|
if (index > 0) {
|
1753
1771
|
pen.children[0].text = index + 1 + '#'
|
1754
1772
|
}
|
1755
|
-
this.bindInfo(
|
1756
|
-
//
|
1757
|
-
|
1758
|
-
|
1759
|
-
|
1760
|
-
|
1761
|
-
|
1762
|
-
|
1763
|
-
|
1764
|
-
|
1765
|
-
|
1766
|
-
|
1767
|
-
|
1768
|
-
}
|
1769
|
-
})
|
1770
|
-
pen.children.forEach((item) => {
|
1771
|
-
item.events = [{
|
1773
|
+
this.bindInfo(itemNode, pen.children[0], type);
|
1774
|
+
// 温度
|
1775
|
+
if(item.temperature) {
|
1776
|
+
pen.children[1].data = [];
|
1777
|
+
this.bindInfo(item.temperature, pen.children[1], 0);
|
1778
|
+
}
|
1779
|
+
// 湿度
|
1780
|
+
if(item.dampness) {
|
1781
|
+
pen.children[2].data = []
|
1782
|
+
this.bindInfo(item.dampness, pen.children[2], 0);
|
1783
|
+
}
|
1784
|
+
pen.children.forEach((itemNode) => {
|
1785
|
+
itemNode.events = [{
|
1772
1786
|
"type": 3,
|
1773
1787
|
"action": 2,
|
1774
1788
|
"value": "",
|
@@ -1777,16 +1791,19 @@ var Topology = (function (_super) {
|
|
1777
1791
|
})
|
1778
1792
|
}
|
1779
1793
|
} else if ([3, '3'].includes(type)) {
|
1780
|
-
const setAreaId = setAreaIdData(
|
1794
|
+
const setAreaId = setAreaIdData(itemNode);
|
1781
1795
|
pen.data.push(...setAreaId);
|
1796
|
+
}else if ([4, '4'].includes(type)) {
|
1797
|
+
const setVarId = setVarValueData(itemNode);
|
1798
|
+
pen.data.push(...setVarId);
|
1782
1799
|
}
|
1783
1800
|
// if([0, 2, '0', '2'].includes(type)) {
|
1784
1801
|
// //用于处理场地监控,点击一个资产类别后,隐藏掉这个类别下的所有元件
|
1785
|
-
// const setThreeCategory = setThreeCategoryIdData(pen,
|
1802
|
+
// const setThreeCategory = setThreeCategoryIdData(pen, itemNode);
|
1786
1803
|
//
|
1787
1804
|
// pen.data.push(...setThreeCategory);
|
1788
1805
|
// }
|
1789
|
-
return pen
|
1806
|
+
return pen;
|
1790
1807
|
};
|
1791
1808
|
Topology.prototype.newId = function (node, idMaps) {
|
1792
1809
|
var old = node.id;
|
@@ -1806,10 +1823,12 @@ var Topology = (function (_super) {
|
|
1806
1823
|
if (!pens) {
|
1807
1824
|
pens = this.activeLayer.pens;
|
1808
1825
|
}
|
1826
|
+
let isAnimate = false;
|
1809
1827
|
for (var _i = 0, pens_1 = pens; _i < pens_1.length; _i++) {
|
1810
1828
|
var pen = pens_1[_i];
|
1811
1829
|
if (pen instanceof Node) {
|
1812
1830
|
let isRotateBug = false
|
1831
|
+
isAnimate = pen.animateFrames && pen.animateFrames.length
|
1813
1832
|
if (pen.rotate === 0) {
|
1814
1833
|
pen.rotate = 360
|
1815
1834
|
isRotateBug = true
|
@@ -1828,6 +1847,7 @@ var Topology = (function (_super) {
|
|
1828
1847
|
this.activeLayer.calcControlPoints();
|
1829
1848
|
this.activeLayer.saveNodeRects();
|
1830
1849
|
this.render();
|
1850
|
+
if(isAnimate) this.animate(true);
|
1831
1851
|
// tslint:disable-next-line: no-unused-expression
|
1832
1852
|
cache && this.cache();
|
1833
1853
|
};
|
@@ -1909,6 +1929,8 @@ var Topology = (function (_super) {
|
|
1909
1929
|
paddingTop: 0,
|
1910
1930
|
paddingBottom: 0,
|
1911
1931
|
strokeStyle: 'transparent',
|
1932
|
+
visible: true,
|
1933
|
+
visibleSwitch: true,
|
1912
1934
|
children: [],
|
1913
1935
|
});
|
1914
1936
|
if (temp) {
|
@@ -1919,9 +1941,13 @@ var Topology = (function (_super) {
|
|
1919
1941
|
item.stand = stand;
|
1920
1942
|
item.parentId = node.id;
|
1921
1943
|
item.animatePlay = false;
|
1944
|
+
item.visible = true;
|
1945
|
+
item.visibleSwitch = true;
|
1922
1946
|
item.calcRectInParent(node);
|
1947
|
+
this.deleteSelectTabOptionNode(item);
|
1923
1948
|
node.children.push(item);
|
1924
1949
|
}
|
1950
|
+
node.order = this.store.data.pens.length;
|
1925
1951
|
this.store.data.pens.push(node);
|
1926
1952
|
this.activeLayer.setPens([node]);
|
1927
1953
|
this.dispatch('node', node);
|
@@ -1935,23 +1961,53 @@ var Topology = (function (_super) {
|
|
1935
1961
|
return;
|
1936
1962
|
}
|
1937
1963
|
const nodeChildren = JSON.parse(JSON.stringify(node));
|
1964
|
+
var i = this.findIndex(nodeChildren);
|
1965
|
+
if (i > -1 && nodeChildren.name === 'combine') {
|
1966
|
+
this.store.data.pens.splice(i, 1);
|
1967
|
+
} else {
|
1968
|
+
nodeChildren.children = null;
|
1969
|
+
}
|
1938
1970
|
for (var _i = 0, _a = nodeChildren.children; _i < _a.length; _i++) {
|
1939
1971
|
var item = new Node(_a[_i]);
|
1940
1972
|
item.parentId = undefined;
|
1941
1973
|
item.rectInParent = undefined;
|
1942
1974
|
item.locked = Lock.None;
|
1975
|
+
item.order = this.store.data.pens.length;
|
1976
|
+
this.addSelectTabOptionNode(item);
|
1943
1977
|
this.store.data.pens.push(item);
|
1944
1978
|
}
|
1945
|
-
|
1946
|
-
if (i > -1 && nodeChildren.name === 'combine') {
|
1947
|
-
this.store.data.pens.splice(i, 1);
|
1948
|
-
} else {
|
1949
|
-
nodeChildren.children = null;
|
1950
|
-
}
|
1979
|
+
this.deleteSelectTabOptionNode(nodeChildren);
|
1951
1980
|
this.cache();
|
1952
1981
|
this.activeLayer.clear();
|
1953
1982
|
this.hoverLayer.clear();
|
1954
1983
|
};
|
1984
|
+
Topology.prototype.deleteSelectTabOptionNode = function (node) {
|
1985
|
+
const tagNode = node.tags.find((t) => {return t.includes('selectOption')});
|
1986
|
+
if(tagNode){
|
1987
|
+
// 删除下拉节点关联的这个元件
|
1988
|
+
const tagArr = tagNode.split('-');
|
1989
|
+
const parentId = tagArr[1] && tagArr[1].trim();
|
1990
|
+
if(parentId && this.store.selectTabDataPool[parentId].has(node.id)) this.store.selectTabDataPool[parentId].delete(node.id);
|
1991
|
+
}
|
1992
|
+
},
|
1993
|
+
Topology.prototype.addSelectTabOptionNode = function (node) {
|
1994
|
+
const tagNode = node.tags.find((t) => {return t.includes('selectOption')});
|
1995
|
+
if(tagNode){
|
1996
|
+
// 添加下拉节点关联的这个元件
|
1997
|
+
const tagArr = tagNode.split('-');
|
1998
|
+
const parentId = tagArr[1] && tagArr[1].trim();
|
1999
|
+
if(!parentId) return;
|
2000
|
+
const params = {
|
2001
|
+
TID: node.TID,
|
2002
|
+
id: node.id,
|
2003
|
+
name: node.name,
|
2004
|
+
order: node.order,
|
2005
|
+
visible: node.visible,
|
2006
|
+
tag: tagNode
|
2007
|
+
}
|
2008
|
+
this.store.selectTabDataPool[parentId].set(node.id, params);
|
2009
|
+
}
|
2010
|
+
},
|
1955
2011
|
Topology.prototype.find = function (idOrTag, pens) {
|
1956
2012
|
var _this = this;
|
1957
2013
|
if (!pens) {
|
package/core/src/divLayer.d.ts
CHANGED
package/core/src/divLayer.js
CHANGED
@@ -22,30 +22,21 @@ var __extends = (this && this.__extends) || (function () {
|
|
22
22
|
import {Store} from 'le5le-store';
|
23
23
|
import {Node, PenType, images, defaultImages} from './models';
|
24
24
|
import {Layer} from './layer';
|
25
|
-
import { setStyleForElementIdDiv
|
25
|
+
import { setStyleForElementIdDiv } from './element';
|
26
26
|
import { commonStore } from './store';
|
27
27
|
var DivLayer = /** @class */ (function (_super) {
|
28
28
|
__extends(DivLayer, _super);
|
29
29
|
function DivLayer(TID) {
|
30
30
|
var _this = _super.call(this, TID) || this;
|
31
31
|
_this.canvas = document.createElement('div');
|
32
|
-
_this.iframes = {};
|
33
32
|
_this.elements = {};
|
34
33
|
_this.gifs = {};
|
35
34
|
_this.addDiv = function (node) {
|
36
|
-
if (node.iframe) {
|
37
|
-
Object.assign(_this.iframes, DomIframes);
|
38
|
-
if (_this.iframes[node.id] && _this.iframes[node.id].src !== node.iframe) {
|
39
|
-
_this.iframes[node.id].src = node.iframe;
|
40
|
-
}
|
41
|
-
_this.setElemPosition(node, _this.iframes[node.id] || _this.addIframe(node));
|
42
|
-
}
|
43
35
|
if (node.elementId) {
|
44
|
-
Object.assign(_this.elements, DomElements);
|
45
36
|
if (!_this.elements[node.id]) {
|
46
37
|
_this.elements[node.id] = document.getElementById(node.id);
|
47
38
|
if (_this.elements[node.id]) {
|
48
|
-
_this.
|
39
|
+
_this.addElement(node);
|
49
40
|
}
|
50
41
|
}
|
51
42
|
_this.setElemPosition(node, _this.elements[node.id]);
|
@@ -84,14 +75,12 @@ var DivLayer = /** @class */ (function (_super) {
|
|
84
75
|
_this.subcribe = Store.subscribe(_this.generateStoreKey('LT:addDiv'), _this.addDiv);
|
85
76
|
return _this;
|
86
77
|
}
|
87
|
-
DivLayer.prototype.
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
this.
|
92
|
-
commonStore[node.TID].parentElem.appendChild(iframe);
|
78
|
+
DivLayer.prototype.addElement = function (node){
|
79
|
+
if(['iframe', 'echarts'].includes(node.name)) {
|
80
|
+
this.canvas.parentNode.appendChild(this.elements[node.id]);
|
81
|
+
}else {
|
82
|
+
this.canvas.appendChild(this.elements[node.id]);
|
93
83
|
}
|
94
|
-
return iframe;
|
95
84
|
};
|
96
85
|
DivLayer.prototype.addGif = function (node) {
|
97
86
|
this.gifs[node.id] = node.img;
|
@@ -99,21 +88,18 @@ var DivLayer = /** @class */ (function (_super) {
|
|
99
88
|
return node.img;
|
100
89
|
};
|
101
90
|
DivLayer.prototype.setElemPosition = function (node, elem) {
|
102
|
-
|
91
|
+
setStyleForElementIdDiv(node, elem, commonStore[this.TID].data);
|
103
92
|
};
|
104
93
|
DivLayer.prototype.removeDiv = function (item) {
|
105
94
|
if (this.curNode && item.id === this.curNode.id) {
|
106
95
|
this.curNode = null;
|
107
96
|
}
|
108
|
-
if (item.iframe) {
|
109
|
-
const iframesNode = this.iframes[item.id] || DomIframes[item.id];
|
110
|
-
commonStore[item.TID].parentElem.removeChild(iframesNode);
|
111
|
-
this.iframes[item.id] ? this.iframes[item.id] = null : DomIframes[item.id] = null;
|
112
|
-
}
|
113
97
|
if (item.elementId) {
|
114
|
-
const elementNode = this.elements[item.id]
|
115
|
-
|
116
|
-
|
98
|
+
const elementNode = this.elements[item.id];
|
99
|
+
if(elementNode) {
|
100
|
+
elementNode.parentNode.removeChild(elementNode);
|
101
|
+
this.elements[item.id] = null;
|
102
|
+
}
|
117
103
|
}
|
118
104
|
if (item.gif) {
|
119
105
|
this.canvas.removeChild(this.gifs[item.id]);
|
@@ -131,15 +117,8 @@ var DivLayer = /** @class */ (function (_super) {
|
|
131
117
|
};
|
132
118
|
DivLayer.prototype.clear = function () {
|
133
119
|
this.canvas.innerHTML = '';
|
134
|
-
this.iframes = {};
|
135
120
|
this.elements = {};
|
136
121
|
this.gifs = {};
|
137
|
-
for (let key in DomIframes) {
|
138
|
-
delete DomIframes[key];
|
139
|
-
}
|
140
|
-
for (let key in DomElements) {
|
141
|
-
delete DomElements[key];
|
142
|
-
}
|
143
122
|
// tslint:disable-next-line:forin
|
144
123
|
for (let key in images) {
|
145
124
|
delete images[key];
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { Node } from '../models';
|
2
|
+
import { visualization2DStore } from '../store';
|
3
|
+
export declare function setStyleForElementIdDiv(node: Node, elem: HTMLElement, data: visualization2DStore): void;
|
4
|
+
export declare function createDiv(node: Node): HTMLDivElement;
|
5
|
+
// export declare function loadJS(url: string, callback?: () => void, render?: boolean): void;
|
@@ -0,0 +1,52 @@
|
|
1
|
+
import {Lock} from '../models';
|
2
|
+
export function setStyleForElementIdDiv(node, elem, data) {
|
3
|
+
if (!elem) return;
|
4
|
+
elem.style.position = 'absolute';
|
5
|
+
elem.style.outline = 'none';
|
6
|
+
elem.style.left = node.rect.x + 'px';
|
7
|
+
elem.style.top = node.rect.y + 'px';
|
8
|
+
elem.style.width = node.rect.width + 'px';
|
9
|
+
elem.style.height = node.rect.height + 'px';
|
10
|
+
if (node.rotate || node.offsetRotate) {
|
11
|
+
elem.style.transform = "rotate(" + (node.rotate + node.offsetRotate) + "deg)";
|
12
|
+
}
|
13
|
+
if (data && data.locked > Lock.None || node.locked > Lock.None) {
|
14
|
+
elem.style.userSelect = 'initial';
|
15
|
+
elem.style.pointerEvents = 'initial';
|
16
|
+
} else {
|
17
|
+
elem.style.userSelect = 'none';
|
18
|
+
elem.style.pointerEvents = 'none';
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
// 创建div
|
23
|
+
export function createDiv(node) {
|
24
|
+
var div = document.createElement('div');
|
25
|
+
div.setAttribute('class', 'topoEchart');
|
26
|
+
div.style.position = 'absolute';
|
27
|
+
div.style.outline = 'none';
|
28
|
+
div.style.left = '-9999px';
|
29
|
+
div.style.bottom = '-9999px';
|
30
|
+
div.style.width = node.rect.width + 'px';
|
31
|
+
div.style.height = node.rect.height + 'px';
|
32
|
+
div.id = node.id;
|
33
|
+
return div;
|
34
|
+
}
|
35
|
+
|
36
|
+
// export function loadJS(url, callback, render) {
|
37
|
+
// var loaderScript = document.createElement('script');
|
38
|
+
// loaderScript.type = 'text/javascript';
|
39
|
+
// loaderScript.src = url;
|
40
|
+
// loaderScript.addEventListener('load', function () {
|
41
|
+
// if (callback) {
|
42
|
+
// callback();
|
43
|
+
// }
|
44
|
+
// // how to do
|
45
|
+
// if (render) {
|
46
|
+
// Store.set('LT:render', true);
|
47
|
+
// }
|
48
|
+
// });
|
49
|
+
// document.body.appendChild(loaderScript);
|
50
|
+
// }
|
51
|
+
|
52
|
+
//# sourceMappingURL=dom.js.map
|
@@ -0,0 +1,12 @@
|
|
1
|
+
// 创建iframe
|
2
|
+
export function createIframeElement(node) {
|
3
|
+
const iframe = document.createElement('iframe');
|
4
|
+
// iframe.scrolling = 'no';
|
5
|
+
iframe.frameBorder = '0';
|
6
|
+
iframe.src = node.iframe;
|
7
|
+
iframe.width = node.rect.width;
|
8
|
+
iframe.height = node.rect.height;
|
9
|
+
iframe.setAttribute('id', node.id);
|
10
|
+
iframe.setAttribute('class', 'topology2dConfIfram');
|
11
|
+
return iframe;
|
12
|
+
}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { Node } from '../models';
|
2
|
+
|
3
|
+
export declare function createSelectElement(node: Node): HTMLDivElement;
|
4
|
+
export declare function createSelectDropdown(node: Node): HTMLDivElement;
|
5
|
+
export declare function createSelectOptions(data: [], node: Node): string;
|
6
|
+
export declare function getSelectedData(e: Event, data: any, editData: any): void;
|
7
|
+
export declare function setSelectInteractiveState(selected: any, node: Node): void;
|
8
|
+
export declare function resetSelectInteractiveState(node: Node): void;
|
9
|
+
export declare function setSelectDropdownInteractiveState(node: any, staticType: any, type: any): void;
|
10
|
+
export declare function setSelectElementPosition(node: Node, type: string): void;
|
11
|
+
export declare function setSelectElementTheme(node: Node): void;
|