dcim-topology2d 2.0.7 → 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 -106
- 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 +18 -18
- package/core/src/common.d.ts +7 -6
- package/core/src/common.js +672 -333
- 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 +32 -54
- 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 +60 -48
- 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 -167
- 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 +8 -37
- 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 -253
- package/chart-diagram/src/utils/conversion.d.ts +0 -18
- package/chart-diagram/src/utils/conversion.js +0 -399
- 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 -129
- 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 -199
- 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 -186
- package/core/src/store/data.js +0 -178
- 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 -168
- package/core/src/utils/params.d.ts +0 -2
- package/core/src/utils/params.js +0 -60
- package/static/echartsDefaultData.js +0 -167
- 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
package/core/src/divLayer.d.ts
CHANGED
@@ -1,7 +1,37 @@
|
|
1
|
-
import {
|
1
|
+
import { Options } from './options';
|
2
|
+
import { Node } from './models/node';
|
3
|
+
import { TopologyData } from './models/data';
|
2
4
|
import { Layer } from './layer';
|
3
5
|
export declare class DivLayer extends Layer {
|
6
|
+
parentElem: HTMLElement;
|
7
|
+
options: Options;
|
8
|
+
protected data: TopologyData;
|
4
9
|
canvas: HTMLDivElement;
|
10
|
+
player: HTMLDivElement;
|
11
|
+
curNode: Node;
|
12
|
+
playBtn: HTMLElement;
|
13
|
+
currentTime: HTMLElement;
|
14
|
+
progressCurrent: HTMLElement;
|
15
|
+
progress: HTMLElement;
|
16
|
+
loop: HTMLElement;
|
17
|
+
media: HTMLMediaElement;
|
18
|
+
videos: {
|
19
|
+
[key: string]: {
|
20
|
+
player: HTMLElement;
|
21
|
+
current: HTMLElement;
|
22
|
+
media: HTMLMediaElement;
|
23
|
+
};
|
24
|
+
};
|
25
|
+
audios: {
|
26
|
+
[key: string]: {
|
27
|
+
player: HTMLElement;
|
28
|
+
current: HTMLElement;
|
29
|
+
media: HTMLMediaElement;
|
30
|
+
};
|
31
|
+
};
|
32
|
+
iframes: {
|
33
|
+
[key: string]: HTMLIFrameElement;
|
34
|
+
};
|
5
35
|
elements: {
|
6
36
|
[key: string]: HTMLElement;
|
7
37
|
};
|
@@ -10,8 +40,12 @@ export declare class DivLayer extends Layer {
|
|
10
40
|
};
|
11
41
|
private subcribe;
|
12
42
|
private subcribeNode;
|
13
|
-
constructor(TID: String);
|
43
|
+
constructor(parentElem: HTMLElement, options: Options, TID: String);
|
14
44
|
addDiv: (node: Node) => void;
|
45
|
+
createPlayer(): void;
|
46
|
+
getMediaCurrent(): void;
|
47
|
+
addMedia(node: Node, type: string): HTMLDivElement;
|
48
|
+
playNext(next: string): void;
|
15
49
|
addIframe(node: Node): HTMLIFrameElement;
|
16
50
|
addGif(node: Node): HTMLImageElement;
|
17
51
|
setElemPosition(node: Node, elem: HTMLElement): void;
|
package/core/src/divLayer.js
CHANGED
@@ -20,23 +20,53 @@ var __extends = (this && this.__extends) || (function () {
|
|
20
20
|
};
|
21
21
|
})();
|
22
22
|
import {Store} from 'le5le-store';
|
23
|
-
import {Node,
|
23
|
+
import {Node, images} from './models/node';
|
24
|
+
import {Lock} from './models/status';
|
25
|
+
import {PenType} from './models/pen';
|
24
26
|
import {Layer} from './layer';
|
25
|
-
import { setStyleForElementIdDiv } from './
|
26
|
-
import { commonStore } from './store';
|
27
|
+
import { setStyleForElementIdDiv, DomElements } from './utils'
|
27
28
|
var DivLayer = /** @class */ (function (_super) {
|
28
29
|
__extends(DivLayer, _super);
|
29
|
-
|
30
|
+
|
31
|
+
function DivLayer(parentElem, options, TID) {
|
32
|
+
if (options === void 0) {
|
33
|
+
options = {};
|
34
|
+
}
|
30
35
|
var _this = _super.call(this, TID) || this;
|
36
|
+
_this.parentElem = parentElem;
|
37
|
+
_this.options = options;
|
31
38
|
_this.canvas = document.createElement('div');
|
39
|
+
// _this.player = document.createElement('div');
|
40
|
+
// _this.videos = {};
|
41
|
+
// _this.audios = {};
|
42
|
+
_this.iframes = {};
|
32
43
|
_this.elements = {};
|
33
44
|
_this.gifs = {};
|
34
45
|
_this.addDiv = function (node) {
|
46
|
+
// if (node.audio) {
|
47
|
+
// if (_this.audios[node.id] && _this.audios[node.id].media.src !== node.audio) {
|
48
|
+
// _this.audios[node.id].media.src = node.audio;
|
49
|
+
// }
|
50
|
+
// _this.setElemPosition(node, (_this.audios[node.id] && _this.audios[node.id].player) || _this.addMedia(node, 'audio'));
|
51
|
+
// }
|
52
|
+
// if (node.video) {
|
53
|
+
// if (_this.videos[node.id] && _this.videos[node.id].media.src !== node.video) {
|
54
|
+
// _this.videos[node.id].media.src = node.video;
|
55
|
+
// }
|
56
|
+
// _this.setElemPosition(node, (_this.videos[node.id] && _this.videos[node.id].player) || _this.addMedia(node, 'video'));
|
57
|
+
// }
|
58
|
+
if (node.iframe) {
|
59
|
+
if (_this.iframes[node.id] && _this.iframes[node.id].src !== node.iframe) {
|
60
|
+
_this.iframes[node.id].src = node.iframe;
|
61
|
+
}
|
62
|
+
_this.setElemPosition(node, _this.iframes[node.id] || _this.addIframe(node));
|
63
|
+
}
|
35
64
|
if (node.elementId) {
|
65
|
+
Object.assign(_this.elements, DomElements);
|
36
66
|
if (!_this.elements[node.id]) {
|
37
67
|
_this.elements[node.id] = document.getElementById(node.id);
|
38
68
|
if (_this.elements[node.id]) {
|
39
|
-
_this.
|
69
|
+
_this.canvas.appendChild(_this.elements[node.id]);
|
40
70
|
}
|
41
71
|
}
|
42
72
|
_this.setElemPosition(node, _this.elements[node.id]);
|
@@ -65,22 +95,249 @@ var DivLayer = /** @class */ (function (_super) {
|
|
65
95
|
}
|
66
96
|
}
|
67
97
|
};
|
98
|
+
_this.data = Store.get(_this.generateStoreKey('topology-data'));
|
99
|
+
// if (!_this.options.playIcon) {
|
100
|
+
// _this.options.playIcon = 'iconfont icon-play';
|
101
|
+
// }
|
102
|
+
// if (!_this.options.pauseIcon) {
|
103
|
+
// _this.options.pauseIcon = 'iconfont icon-pause';
|
104
|
+
// }
|
105
|
+
// if (!_this.options.fullScreenIcon) {
|
106
|
+
// _this.options.fullScreenIcon = 'iconfont icon-full-screen';
|
107
|
+
// }
|
108
|
+
// if (!_this.options.loopIcon) {
|
109
|
+
// _this.options.loopIcon = 'iconfont icon-loop';
|
110
|
+
// }
|
68
111
|
_this.canvas.style.position = 'absolute';
|
69
112
|
_this.canvas.style.left = '0';
|
70
113
|
_this.canvas.style.top = '0';
|
71
114
|
_this.canvas.style.outline = 'none';
|
72
115
|
_this.canvas.style.background = 'transparent';
|
73
116
|
_this.canvas.setAttribute('class', 'canvas-point');
|
74
|
-
|
117
|
+
parentElem.appendChild(_this.canvas);
|
118
|
+
// parentElem.appendChild(_this.player);
|
119
|
+
//_this.createPlayer();
|
75
120
|
_this.subcribe = Store.subscribe(_this.generateStoreKey('LT:addDiv'), _this.addDiv);
|
121
|
+
// _this.subcribeNode = Store.subscribe(_this.generateStoreKey('LT:activeNode'), function (node) {
|
122
|
+
// if (!node || (!node.video && !node.audio)) {
|
123
|
+
// _this.player.style.top = '-99999px';
|
124
|
+
// return;
|
125
|
+
// }
|
126
|
+
// if (node.audio && _this.audios[node.id]) {
|
127
|
+
// _this.media = _this.audios[node.id].media;
|
128
|
+
// }
|
129
|
+
// else if (node.video && _this.videos[node.id]) {
|
130
|
+
// _this.media = _this.videos[node.id].media;
|
131
|
+
// }
|
132
|
+
// else {
|
133
|
+
// return;
|
134
|
+
// }
|
135
|
+
// _this.curNode = node;
|
136
|
+
// _this.player.style.top = _this.parentElem.offsetTop + _this.parentElem.clientHeight + 'px';
|
137
|
+
// _this.player.style.left = _this.parentElem.getBoundingClientRect().left + 'px';
|
138
|
+
// _this.player.style.width = _this.parentElem.clientWidth + 'px';
|
139
|
+
// _this.getMediaCurrent();
|
140
|
+
// if (_this.media.paused) {
|
141
|
+
// _this.playBtn.className = _this.options.playIcon;
|
142
|
+
// }
|
143
|
+
// else {
|
144
|
+
// _this.playBtn.className = _this.options.pauseIcon;
|
145
|
+
// }
|
146
|
+
// });
|
147
|
+
// document.addEventListener('fullscreenchange', function (e) {
|
148
|
+
// if (!_this.media) {
|
149
|
+
// return;
|
150
|
+
// }
|
151
|
+
// if (document.fullscreen) {
|
152
|
+
// _this.media.controls = true;
|
153
|
+
// _this.media.style.userSelect = 'initial';
|
154
|
+
// _this.media.style.pointerEvents = 'initial';
|
155
|
+
// }
|
156
|
+
// else {
|
157
|
+
// _this.media.style.userSelect = 'none';
|
158
|
+
// _this.media.style.pointerEvents = 'none';
|
159
|
+
// _this.media.controls = false;
|
160
|
+
// }
|
161
|
+
// });
|
76
162
|
return _this;
|
77
163
|
}
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
164
|
+
|
165
|
+
DivLayer.prototype.createPlayer = function () {
|
166
|
+
var _this = this;
|
167
|
+
this.player.style.position = 'fixed';
|
168
|
+
this.player.style.outline = 'none';
|
169
|
+
this.player.style.top = '-99999px';
|
170
|
+
this.player.style.height = '40px';
|
171
|
+
this.player.style.padding = '10px 15px';
|
172
|
+
this.player.style.background = 'rgba(200,200,200,.1)';
|
173
|
+
this.player.style.display = 'flex';
|
174
|
+
this.player.style.alignItems = 'center';
|
175
|
+
this.player.style.userSelect = 'initial';
|
176
|
+
this.player.style.pointerEvents = 'initial';
|
177
|
+
this.player.style.zIndex = '1';
|
178
|
+
this.playBtn = document.createElement('i');
|
179
|
+
this.currentTime = document.createElement('span');
|
180
|
+
this.progress = document.createElement('div');
|
181
|
+
this.progressCurrent = document.createElement('div');
|
182
|
+
this.loop = document.createElement('i');
|
183
|
+
var fullScreen = document.createElement('i');
|
184
|
+
this.playBtn.className = this.options.playIcon;
|
185
|
+
this.playBtn.style.fontSize = '18px';
|
186
|
+
this.playBtn.style.lineHeight = '20px';
|
187
|
+
this.playBtn.style.cursor = 'pointer';
|
188
|
+
this.currentTime.style.padding = '0 10px';
|
189
|
+
this.currentTime.innerText = '0 / 0';
|
190
|
+
this.progress.style.position = 'relative';
|
191
|
+
this.progress.style.flexGrow = '1';
|
192
|
+
this.progress.style.top = '0';
|
193
|
+
this.progress.style.height = '4px';
|
194
|
+
this.progress.style.background = '#ccc';
|
195
|
+
this.progress.style.borderRadius = '2px';
|
196
|
+
this.progress.style.overflow = 'hidden';
|
197
|
+
this.progress.style.cursor = 'pointer';
|
198
|
+
this.progressCurrent.style.position = 'absolute';
|
199
|
+
this.progressCurrent.style.left = '0';
|
200
|
+
this.progressCurrent.style.top = '0';
|
201
|
+
this.progressCurrent.style.bottom = '0';
|
202
|
+
this.progressCurrent.style.width = '0';
|
203
|
+
this.progressCurrent.style.background = '#52c41a';
|
204
|
+
this.loop.style.margin = '0 10px';
|
205
|
+
this.loop.style.padding = '2px 5px';
|
206
|
+
this.loop.style.borderRadius = '2px';
|
207
|
+
this.loop.className = this.options.loopIcon;
|
208
|
+
this.loop.style.fontSize = '18px';
|
209
|
+
this.loop.style.lineHeight = '20px';
|
210
|
+
this.loop.style.cursor = 'pointer';
|
211
|
+
fullScreen.className = this.options.fullScreenIcon;
|
212
|
+
fullScreen.style.fontSize = '17px';
|
213
|
+
fullScreen.style.lineHeight = '20px';
|
214
|
+
fullScreen.style.cursor = 'pointer';
|
215
|
+
this.player.appendChild(this.playBtn);
|
216
|
+
this.player.appendChild(this.currentTime);
|
217
|
+
this.player.appendChild(this.progress);
|
218
|
+
this.progress.appendChild(this.progressCurrent);
|
219
|
+
this.player.appendChild(this.loop);
|
220
|
+
this.player.appendChild(fullScreen);
|
221
|
+
this.playBtn.onclick = function () {
|
222
|
+
if (_this.media.paused) {
|
223
|
+
_this.media.play();
|
224
|
+
_this.playBtn.className = _this.options.pauseIcon;
|
225
|
+
} else {
|
226
|
+
_this.media.pause();
|
227
|
+
_this.playBtn.className = _this.options.playIcon;
|
228
|
+
}
|
229
|
+
};
|
230
|
+
this.progress.onclick = function (e) {
|
231
|
+
_this.media.currentTime = (e.offsetX / _this.progress.clientWidth) * _this.media.duration;
|
232
|
+
};
|
233
|
+
this.loop.onclick = function () {
|
234
|
+
_this.media.loop = !_this.media.loop;
|
235
|
+
_this.curNode.playLoop = _this.media.loop;
|
236
|
+
if (_this.media.loop) {
|
237
|
+
_this.loop.style.background = '#ddd';
|
238
|
+
} else {
|
239
|
+
_this.loop.style.background = 'none';
|
240
|
+
}
|
241
|
+
};
|
242
|
+
fullScreen.onclick = function () {
|
243
|
+
_this.media.requestFullscreen();
|
244
|
+
};
|
245
|
+
};
|
246
|
+
DivLayer.prototype.getMediaCurrent = function () {
|
247
|
+
if (!this.media) {
|
248
|
+
return;
|
83
249
|
}
|
250
|
+
this.currentTime.innerText =
|
251
|
+
this.formatSeconds(this.media.currentTime) + ' / ' + this.formatSeconds(this.media.duration);
|
252
|
+
this.progressCurrent.style.width =
|
253
|
+
(this.media.currentTime / this.media.duration) * this.progress.clientWidth + 'px';
|
254
|
+
};
|
255
|
+
DivLayer.prototype.addMedia = function (node, type) {
|
256
|
+
var _this = this;
|
257
|
+
var player = document.createElement('div');
|
258
|
+
var current = document.createElement('div');
|
259
|
+
var media = document.createElement(type);
|
260
|
+
current.style.position = 'absolute';
|
261
|
+
current.style.outline = 'none';
|
262
|
+
current.style.left = '0';
|
263
|
+
current.style.bottom = '0';
|
264
|
+
current.style.height = '2px';
|
265
|
+
current.style.background = '#52c41a';
|
266
|
+
media.style.position = 'absolute';
|
267
|
+
media.style.outline = 'none';
|
268
|
+
media.style.left = '0';
|
269
|
+
media.style.right = '0';
|
270
|
+
media.style.top = '0';
|
271
|
+
media.style.bottom = '0';
|
272
|
+
if (type === 'video') {
|
273
|
+
media.style.width = node.rect.width + 'px';
|
274
|
+
media.style.height = node.rect.height + 'px';
|
275
|
+
}
|
276
|
+
player.style.background = 'transparent';
|
277
|
+
if (node.play === 1) {
|
278
|
+
media.autoplay = true;
|
279
|
+
}
|
280
|
+
media.loop = node.playLoop;
|
281
|
+
media.ontimeupdate = function () {
|
282
|
+
current.style.width = (media.currentTime / media.duration) * node.rect.width + 'px';
|
283
|
+
_this.getMediaCurrent();
|
284
|
+
if (_this.media === media) {
|
285
|
+
if (node.playLoop) {
|
286
|
+
media.loop = true;
|
287
|
+
_this.loop.style.background = '#ddd';
|
288
|
+
} else {
|
289
|
+
media.loop = false;
|
290
|
+
_this.loop.style.background = 'none';
|
291
|
+
}
|
292
|
+
}
|
293
|
+
};
|
294
|
+
media.onended = function () {
|
295
|
+
Store.set(_this.generateStoreKey('mediaEnd'), node);
|
296
|
+
if (_this.media === media) {
|
297
|
+
_this.playBtn.className = _this.options.playIcon;
|
298
|
+
}
|
299
|
+
_this.playNext(node.nextPlay);
|
300
|
+
};
|
301
|
+
media.onloadedmetadata = function () {
|
302
|
+
_this.getMediaCurrent();
|
303
|
+
};
|
304
|
+
media.src = node[type];
|
305
|
+
player.appendChild(media);
|
306
|
+
player.appendChild(current);
|
307
|
+
this[type + 's'][node.id] = {
|
308
|
+
player: player,
|
309
|
+
current: current,
|
310
|
+
media: media
|
311
|
+
};
|
312
|
+
this.canvas.appendChild(player);
|
313
|
+
return player;
|
314
|
+
};
|
315
|
+
DivLayer.prototype.playNext = function (next) {
|
316
|
+
if (!next) {
|
317
|
+
return;
|
318
|
+
}
|
319
|
+
for (var _i = 0, _a = this.data.pens; _i < _a.length; _i++) {
|
320
|
+
var item = _a[_i];
|
321
|
+
if (!(item instanceof Node)) {
|
322
|
+
continue;
|
323
|
+
}
|
324
|
+
if (item.tags.indexOf(next) > -1) {
|
325
|
+
if (item.audio && this.audios[item.id] && this.audios[item.id].media && this.audios[item.id].media.paused) {
|
326
|
+
this.audios[item.id].media.play();
|
327
|
+
} else if (item.video && this.videos[item.id].media && this.videos[item.id].media.paused) {
|
328
|
+
this.videos[item.id].media.play();
|
329
|
+
}
|
330
|
+
}
|
331
|
+
}
|
332
|
+
};
|
333
|
+
DivLayer.prototype.addIframe = function (node) {
|
334
|
+
var iframe = document.createElement('iframe');
|
335
|
+
iframe.scrolling = 'no';
|
336
|
+
iframe.frameBorder = '0';
|
337
|
+
iframe.src = node.iframe;
|
338
|
+
this.iframes[node.id] = iframe;
|
339
|
+
this.canvas.appendChild(iframe);
|
340
|
+
return iframe;
|
84
341
|
};
|
85
342
|
DivLayer.prototype.addGif = function (node) {
|
86
343
|
this.gifs[node.id] = node.img;
|
@@ -88,18 +345,30 @@ var DivLayer = /** @class */ (function (_super) {
|
|
88
345
|
return node.img;
|
89
346
|
};
|
90
347
|
DivLayer.prototype.setElemPosition = function (node, elem) {
|
91
|
-
|
348
|
+
setStyleForElementIdDiv(node, elem, this.data);
|
92
349
|
};
|
93
350
|
DivLayer.prototype.removeDiv = function (item) {
|
94
351
|
if (this.curNode && item.id === this.curNode.id) {
|
95
352
|
this.curNode = null;
|
353
|
+
// this.media = null;
|
354
|
+
// this.player.style.top = '-99999px';
|
355
|
+
}
|
356
|
+
// if (item.audio) {
|
357
|
+
// this.canvas.removeChild(this.audios[item.id].player);
|
358
|
+
// this.audios[item.id] = null;
|
359
|
+
// }
|
360
|
+
// if (item.video) {
|
361
|
+
// this.canvas.removeChild(this.videos[item.id].player);
|
362
|
+
// this.videos[item.id] = null;
|
363
|
+
// }
|
364
|
+
if (item.iframe) {
|
365
|
+
this.canvas.removeChild(this.iframes[item.id]);
|
366
|
+
this.iframes[item.id] = null;
|
96
367
|
}
|
97
368
|
if (item.elementId) {
|
98
|
-
const elementNode = this.elements[item.id];
|
99
|
-
|
100
|
-
|
101
|
-
this.elements[item.id] = null;
|
102
|
-
}
|
369
|
+
const elementNode = this.elements[item.id] || DomElements[item.id];
|
370
|
+
this.canvas.removeChild(elementNode);
|
371
|
+
this.elements[item.id] = null;
|
103
372
|
}
|
104
373
|
if (item.gif) {
|
105
374
|
this.canvas.removeChild(this.gifs[item.id]);
|
@@ -117,15 +386,19 @@ var DivLayer = /** @class */ (function (_super) {
|
|
117
386
|
};
|
118
387
|
DivLayer.prototype.clear = function () {
|
119
388
|
this.canvas.innerHTML = '';
|
389
|
+
//this.audios = {};
|
390
|
+
//this.videos = {};
|
391
|
+
this.iframes = {};
|
120
392
|
this.elements = {};
|
121
393
|
this.gifs = {};
|
394
|
+
for (var key in DomElements) {
|
395
|
+
delete DomElements[key];
|
396
|
+
}
|
122
397
|
// tslint:disable-next-line:forin
|
123
|
-
for (
|
398
|
+
for (var key in images) {
|
124
399
|
delete images[key];
|
125
400
|
}
|
126
|
-
|
127
|
-
delete defaultImages[key];
|
128
|
-
}
|
401
|
+
//this.player.style.top = '-99999px';
|
129
402
|
};
|
130
403
|
DivLayer.prototype.formatSeconds = function (seconds) {
|
131
404
|
var h = Math.floor(seconds / 3600);
|
@@ -143,30 +416,25 @@ var DivLayer = /** @class */ (function (_super) {
|
|
143
416
|
return txt;
|
144
417
|
};
|
145
418
|
DivLayer.prototype.resize = function (size) {
|
146
|
-
let store = commonStore[this.TID];
|
147
|
-
if(!store || !store.options) return;
|
148
419
|
if (size) {
|
149
420
|
this.canvas.style.width = size.width + 'px';
|
150
421
|
this.canvas.style.height = size.height + 'px';
|
151
422
|
} else {
|
152
|
-
if (
|
153
|
-
this.canvas.style.width =
|
423
|
+
if (this.options.width && this.options.width !== 'auto') {
|
424
|
+
this.canvas.style.width = this.options.width + 'px';
|
154
425
|
} else {
|
155
|
-
this.canvas.style.width =
|
426
|
+
this.canvas.style.width = this.parentElem.clientWidth + 'px';
|
156
427
|
}
|
157
|
-
if (
|
158
|
-
this.canvas.style.height =
|
428
|
+
if (this.options.height && this.options.height !== 'auto') {
|
429
|
+
this.canvas.style.height = this.options.height + 'px';
|
159
430
|
} else {
|
160
|
-
this.canvas.style.height =
|
431
|
+
this.canvas.style.height = this.parentElem.clientHeight - 8 + 'px';
|
161
432
|
}
|
162
433
|
}
|
163
|
-
store = null;
|
164
434
|
};
|
165
435
|
DivLayer.prototype.render = function () {
|
166
|
-
|
167
|
-
for (var _i = 0, _a = commonStore[this.TID].data.pens; _i < _a.length; _i++) {
|
436
|
+
for (var _i = 0, _a = this.data.pens; _i < _a.length; _i++) {
|
168
437
|
var item = _a[_i];
|
169
|
-
if(!(item instanceof Node)) item = new Node(item);
|
170
438
|
if (!item.getTID()) {
|
171
439
|
item.setTID(this.TID);
|
172
440
|
}
|
@@ -177,6 +445,8 @@ var DivLayer = /** @class */ (function (_super) {
|
|
177
445
|
DivLayer.prototype.destroy = function () {
|
178
446
|
this.clear();
|
179
447
|
this.subcribe.unsubscribe();
|
448
|
+
//this.subcribeNode.unsubscribe();
|
449
|
+
|
180
450
|
//优化
|
181
451
|
this.canvas.onmousemove = null;
|
182
452
|
this.canvas.onmousedown = null
|
@@ -187,6 +457,8 @@ var DivLayer = /** @class */ (function (_super) {
|
|
187
457
|
this.canvas.ondragover = null;
|
188
458
|
this.canvas.ondrop = null;
|
189
459
|
this.canvas.onwheel = null;
|
460
|
+
|
461
|
+
this.data = null;
|
190
462
|
//end
|
191
463
|
};
|
192
464
|
|
@@ -4,4 +4,5 @@ export declare function setConfItemNode(item: any[], syncData: Node): Node;
|
|
4
4
|
export declare function setNodeEvents(item: any[], pen: Pen): void;
|
5
5
|
export declare function setControlData(pen: Pen, syncData: Node): void;
|
6
6
|
export declare function getControlNode(item: any, data: any): Node;
|
7
|
-
export declare function getDetailData(data: Node): void;
|
7
|
+
export declare function getDetailData(data: Node): void;
|
8
|
+
export declare function setStatisticalData(pen: Pen, data: any): Node;
|
@@ -1,23 +1,10 @@
|
|
1
1
|
//let DETAILDATA = null;
|
2
|
-
import {commonStore} from '../store';
|
3
|
-
import { getEchartsRealData } from '../utils/conversion';
|
4
2
|
export function setConfItemNode(pen, syn_synata) {
|
5
|
-
|
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
|
-
}
|
15
|
-
if (!pen.data) return;
|
16
|
-
if(commonStore[pen.TID]) commonStore[pen.TID].data.dataResize = 1;
|
17
|
-
let isAlarm = false; // 判断元件绑定的数据中是否有告警发生,用于九所项目服务器自身监控功能
|
3
|
+
if (!pen.data) return
|
18
4
|
if(pen.data instanceof Array) {
|
19
|
-
let _syn =
|
20
|
-
let isResetVal = false
|
5
|
+
let _syn = ''
|
6
|
+
let isResetVal = false
|
7
|
+
let isResetFontColor = false
|
21
8
|
const {areaData, assetData, kpiData, tagData, asset} = syn_synata
|
22
9
|
pen.data.map((d) => {
|
23
10
|
const key = d.key;
|
@@ -25,7 +12,7 @@ export function setConfItemNode(pen, syn_synata) {
|
|
25
12
|
const assetItem = assetData[value];
|
26
13
|
const areaItem = areaData[value];
|
27
14
|
const kpiItem = kpiData[value];
|
28
|
-
if(key === 'tagId') value = d.tagId ? d.tagId : d.value
|
15
|
+
if(key === 'tagId') value = d.tagId ? d.tagId : d.value
|
29
16
|
const tagItem = tagData[value];
|
30
17
|
//console.log('key===========', d)
|
31
18
|
if (key === 'assetKey' && d.value === 'assetName' && asset) {
|
@@ -38,7 +25,7 @@ export function setConfItemNode(pen, syn_synata) {
|
|
38
25
|
}else if (key === 'tagId' && tagItem) {
|
39
26
|
_syn = tagItem;
|
40
27
|
if(_syn.kpiName !== '通讯状态' || pen.name !== 'circle'){
|
41
|
-
isResetVal = true
|
28
|
+
isResetVal = true
|
42
29
|
}
|
43
30
|
const isControl = parseInt(tagItem.isControlDis); // 是否可控,0可控,1不可控
|
44
31
|
//d.isControlDis = isControlDis
|
@@ -60,7 +47,6 @@ export function setConfItemNode(pen, syn_synata) {
|
|
60
47
|
}
|
61
48
|
}
|
62
49
|
})
|
63
|
-
if(!_syn) return;
|
64
50
|
// const type = parseInt(_syn.type) // 是否是开关量
|
65
51
|
// 显示的值
|
66
52
|
if (isResetVal) pen.text = `${_syn.value}${_syn.unit}`;
|
@@ -72,11 +58,9 @@ export function setConfItemNode(pen, syn_synata) {
|
|
72
58
|
switch (state) {
|
73
59
|
case 0: // 正常告警
|
74
60
|
color = '#FF0000';
|
75
|
-
isAlarm = true;
|
76
61
|
break;
|
77
62
|
case 1: // 离线告警, 通讯开关告警
|
78
63
|
color = '#6d6d6d';
|
79
|
-
isAlarm = true;
|
80
64
|
break;
|
81
65
|
case 2: // 未告警
|
82
66
|
case 3: // 无告警
|
@@ -94,6 +78,7 @@ export function setConfItemNode(pen, syn_synata) {
|
|
94
78
|
color = '#D38C00';
|
95
79
|
break;
|
96
80
|
}
|
81
|
+
|
97
82
|
// 显示的属性
|
98
83
|
if (name === 'text') {
|
99
84
|
pen.font.color = color
|
@@ -103,25 +88,74 @@ export function setConfItemNode(pen, syn_synata) {
|
|
103
88
|
}else {
|
104
89
|
pen.fillStyle = color
|
105
90
|
}
|
91
|
+
|
106
92
|
if (name === 'electricFan') setFanData(pen, _syn)
|
107
93
|
}else {
|
108
94
|
if (pen.elementRendered) pen.elementRendered = false;
|
109
|
-
if
|
110
|
-
const {echartDataValue} = syn_synata;
|
95
|
+
if(pen.data.params && pen.data.echarts) {
|
96
|
+
const { echartDataValue } = syn_synata;
|
97
|
+
//const seriesData = pen.data.echarts.option.series.length > 1 ? echartDataValue : echartData
|
111
98
|
const seriesData = echartDataValue;
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
99
|
+
if(seriesData) pen.data.echarts = setStatisticalData(pen, seriesData)
|
100
|
+
}
|
101
|
+
}
|
102
|
+
return pen
|
103
|
+
}
|
104
|
+
export function setStatisticalData(pen, echartData) {
|
105
|
+
const node = Object.assign({}, pen);
|
106
|
+
const displayMode = parseInt(node.data.echarts.option.displayMode);
|
107
|
+
const chartData = echartData[node.data.params.id];
|
108
|
+
if ((displayMode === 1 || displayMode === 2) && chartData){ // 折线图,柱状图
|
109
|
+
//const xData = [], seriesData = [];
|
110
|
+
const staticForType = node.data.params.staticForType ? node.data.params.staticForType : '';//统计类型:日,周,月,年
|
111
|
+
const seriesNodes = node.data.echarts.option.series;
|
112
|
+
// 双轴曲线
|
113
|
+
if(seriesNodes.length > 1 || node.data.params.curveNum > 1){
|
114
|
+
const chartOptions = staticForType ? chartData[`${staticForType}_Data`] : chartData;
|
115
|
+
const legendData = [];
|
116
|
+
if(!chartOptions) return;
|
117
|
+
node.data.echarts.option.xAxis[0].data = chartOptions.XData;
|
118
|
+
let legend = node.data.echarts.option.legend;
|
119
|
+
if(chartOptions.seriesData.length) {
|
120
|
+
//循环给每条统计数据赋值
|
121
|
+
seriesNodes.map((item, index) => {
|
122
|
+
const { name, data } = chartOptions.seriesData[index];
|
123
|
+
item.name = name;
|
124
|
+
item.data = data;
|
125
|
+
legendData.push(name);
|
126
|
+
});
|
127
|
+
legend.data = legendData;
|
128
|
+
}else {
|
129
|
+
node.data.echarts.option.legend = [];
|
130
|
+
node.data.echarts.option.series = []
|
131
|
+
}
|
132
|
+
}else {
|
133
|
+
const chartOptions = staticForType ? chartData[`${staticForType}_Data`] : chartData;
|
134
|
+
if(chartOptions) {
|
135
|
+
node.data.echarts.option.xAxis[0].data = chartOptions.XData;
|
136
|
+
node.data.echarts.option.series[0].data = chartOptions.seriesData;
|
117
137
|
}
|
118
138
|
}
|
119
139
|
}
|
120
|
-
|
121
|
-
|
140
|
+
if (displayMode === 5 && chartData){ // 饼图
|
141
|
+
const colors = node.data.echarts.option.color;
|
142
|
+
const seriesData = [];
|
143
|
+
chartData.map((chd, index) => {
|
144
|
+
seriesData.push({
|
145
|
+
itemStyle: { color: colors[index] },
|
146
|
+
name: chd.name,
|
147
|
+
value: chd.value
|
148
|
+
})
|
149
|
+
})
|
150
|
+
node.data.echarts.option.series[0].data = seriesData;
|
151
|
+
}
|
152
|
+
if(displayMode === 6 && chartData){ // 仪表盘
|
153
|
+
node.appearance.title.text = chartData.name;
|
154
|
+
node.data.echarts.option.title.text = chartData.name;
|
155
|
+
node.data.echarts.option.series[0].data[0].value = chartData.value;
|
122
156
|
}
|
157
|
+
return node.data.echarts;
|
123
158
|
}
|
124
|
-
|
125
159
|
export function setNodeEvents(item, pen) {
|
126
160
|
|
127
161
|
}
|
package/core/src/hoverLayer.d.ts
CHANGED
@@ -1,6 +1,13 @@
|
|
1
|
-
import {
|
1
|
+
import { TopologyData } from './models/data';
|
2
|
+
import { Rect } from './models/rect';
|
3
|
+
import { Point } from './models/point';
|
4
|
+
import { Line } from './models/line';
|
5
|
+
import { Node } from './models/node';
|
6
|
+
import { Options } from './options';
|
2
7
|
import { Layer } from './layer';
|
3
8
|
export declare class HoverLayer extends Layer {
|
9
|
+
options: Options;
|
10
|
+
protected data: TopologyData;
|
4
11
|
line: Line;
|
5
12
|
initLine: Line;
|
6
13
|
node: Node;
|
@@ -12,7 +19,7 @@ export declare class HoverLayer extends Layer {
|
|
12
19
|
dockLineY: number;
|
13
20
|
root: Node;
|
14
21
|
dragRect: Rect;
|
15
|
-
constructor(TID: String);
|
22
|
+
constructor(options: Options, TID: String);
|
16
23
|
lineTo(to: Point, toArrow?: string): void;
|
17
24
|
lineFrom(from: Point): void;
|
18
25
|
lineMove(pt: Point, initPos: {
|