@flexem/fc-gui 3.0.0-alpha.121 → 3.0.0-alpha.123
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/bundles/@flexem/fc-gui.umd.js +456 -831
- package/bundles/@flexem/fc-gui.umd.js.map +1 -1
- package/bundles/@flexem/fc-gui.umd.min.js +3 -3
- package/bundles/@flexem/fc-gui.umd.min.js.map +1 -1
- package/elements/main-element.js +1 -5
- package/elements/main-element.metadata.json +1 -1
- package/elements/shared/graph/graph-state-element.d.ts +1 -0
- package/elements/shared/graph/graph-state-element.js +30 -1
- package/elements/shared/graph/graph-state-element.metadata.json +1 -1
- package/elements/switch-indicator-light/switch-indicator-light-element.d.ts +2 -0
- package/elements/switch-indicator-light/switch-indicator-light-element.js +25 -1
- package/elements/switch-indicator-light/switch-indicator-light-element.metadata.json +1 -1
- package/package.json +1 -1
- package/shared/gui-consts.d.ts +0 -1
- package/shared/gui-consts.js +1 -2
- package/shared/gui-consts.metadata.json +1 -1
- package/elements/scroll-alarm/scroll-alarm-element.d.ts +0 -50
- package/elements/scroll-alarm/scroll-alarm-element.js +0 -421
- package/elements/scroll-alarm/scroll-alarm-element.metadata.json +0 -1
- package/model/scroll-alarm/scroll-alarm.model.d.ts +0 -21
- package/model/scroll-alarm/scroll-alarm.model.js +0 -0
- package/model/scroll-alarm/scroll-alarm.model.metadata.json +0 -1
package/elements/main-element.js
CHANGED
|
@@ -29,7 +29,6 @@ import { VideoElement } from './video/video-element';
|
|
|
29
29
|
import { WeatherElement } from './weather/weater-element';
|
|
30
30
|
import { AirQualityElement } from './air-quality/air-quality-element';
|
|
31
31
|
import { AlarmElement } from './alarm/alarm-element';
|
|
32
|
-
import { ScrollAlarmElement } from './scroll-alarm/scroll-alarm-element';
|
|
33
32
|
export class MainElement {
|
|
34
33
|
constructor(injector, bsModalService, context, variableCommunicator, popupViewService, signalRAppId) {
|
|
35
34
|
this.injector = injector;
|
|
@@ -134,9 +133,6 @@ export class MainElement {
|
|
|
134
133
|
case GuiConsts.components.alarmKey:
|
|
135
134
|
this.elements.push(new AlarmElement(element, this.injector, this.context.permissionChecker, this.variableCommunicator, this.context.configStore.variableStore, this.context.configStore.alarmsStore, this.signalRAppId));
|
|
136
135
|
break;
|
|
137
|
-
case GuiConsts.components.scrollAlarmKey:
|
|
138
|
-
this.elements.push(new ScrollAlarmElement(element, this.injector, this.context.permissionChecker, this.variableCommunicator, this.context.configStore.variableStore, this.context.configStore.alarmsStore, this.signalRAppId));
|
|
139
|
-
break;
|
|
140
136
|
}
|
|
141
137
|
});
|
|
142
138
|
this.initBackground();
|
|
@@ -302,7 +298,7 @@ export class MainElement {
|
|
|
302
298
|
each(this.elements, e => {
|
|
303
299
|
if (e instanceof HistoricalCurveElement || e instanceof VideoElement
|
|
304
300
|
|| e instanceof WeatherElement || e instanceof NumericalDisplayElement || e instanceof TextElement
|
|
305
|
-
|| e instanceof AirQualityElement || e instanceof
|
|
301
|
+
|| e instanceof AirQualityElement || e instanceof SwitchIndicatorLightElement) {
|
|
306
302
|
e.dispose();
|
|
307
303
|
}
|
|
308
304
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"MainElement":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"Injector","line":
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"MainElement":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"Injector","line":55,"character":43},{"__symbolic":"reference","module":"ngx-bootstrap/modal","name":"BsModalService","line":56,"character":41},{"__symbolic":"reference","module":"../gui/gui-context","name":"GuiContext","line":57,"character":34},{"__symbolic":"reference","module":"../communication","name":"VariableCommunicator","line":58,"character":47},{"__symbolic":"reference","module":"../view/popup-view.service","name":"PopupViewService","line":59,"character":43},null]}],"load":[{"__symbolic":"method"}],"uniformStretch":[{"__symbolic":"method"}],"changeVideoStyle":[{"__symbolic":"method"}],"horizontalStretch":[{"__symbolic":"method"}],"initElementState":[{"__symbolic":"method"}],"getVariableNames":[{"__symbolic":"method"}],"reportVariableStates":[{"__symbolic":"method"}],"getVirtualDeviceIdFromRect":[{"__symbolic":"method"}],"reportVariableValues":[{"__symbolic":"method"}],"dispose":[{"__symbolic":"method"}],"checkIsLoaded":[{"__symbolic":"method"}],"initBackground":[{"__symbolic":"method"}],"getImageEl":[{"__symbolic":"method"}]}}}}]
|
|
@@ -42,12 +42,19 @@ export class GraphStateElement {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
changeGraph(stateId, graphResult) {
|
|
45
|
+
// 检查元素是否已被销毁
|
|
46
|
+
if (!this._element) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
45
49
|
if (!graphResult.failed) {
|
|
46
50
|
const graph = graphResult.graph;
|
|
47
51
|
switch (graph.graphType) {
|
|
48
52
|
case GraphType.Image:
|
|
49
53
|
case GraphType.SVG:
|
|
50
54
|
const imageElement = this.getImageElement();
|
|
55
|
+
if (!imageElement) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
51
58
|
imageElement.setAttributeNS('http://www.w3.org/1999/xlink', 'href', graph.source);
|
|
52
59
|
this.doFaultFlicker(imageElement, stateId);
|
|
53
60
|
break;
|
|
@@ -63,6 +70,10 @@ export class GraphStateElement {
|
|
|
63
70
|
}
|
|
64
71
|
getImageElement() {
|
|
65
72
|
if (!this.imageElement) {
|
|
73
|
+
// 检查 _element 是否已被销毁
|
|
74
|
+
if (!this._element) {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
66
77
|
this.imageElement = document.createElementNS('http://www.w3.org/2000/svg', 'image');
|
|
67
78
|
this.imageElement.setAttribute('width', this.width + '');
|
|
68
79
|
this.imageElement.setAttribute('height', this.height + '');
|
|
@@ -74,7 +85,7 @@ export class GraphStateElement {
|
|
|
74
85
|
return this.imageElement;
|
|
75
86
|
}
|
|
76
87
|
removeImageElement() {
|
|
77
|
-
if (this.imageElement) {
|
|
88
|
+
if (this.imageElement && this._element) {
|
|
78
89
|
this._element.removeChild(this.imageElement);
|
|
79
90
|
delete this.imageElement;
|
|
80
91
|
}
|
|
@@ -107,4 +118,22 @@ export class GraphStateElement {
|
|
|
107
118
|
}
|
|
108
119
|
}
|
|
109
120
|
}
|
|
121
|
+
dispose() {
|
|
122
|
+
// 清理定时器
|
|
123
|
+
if (this.faultFlickerInterval) {
|
|
124
|
+
clearInterval(this.faultFlickerInterval);
|
|
125
|
+
this.faultFlickerInterval = undefined;
|
|
126
|
+
}
|
|
127
|
+
// 移除图片元素
|
|
128
|
+
this.removeImageElement();
|
|
129
|
+
// 清理图形缓存
|
|
130
|
+
if (this.graphs) {
|
|
131
|
+
this.graphs.clear();
|
|
132
|
+
}
|
|
133
|
+
// 清理 SVG 元素
|
|
134
|
+
if (this._element && this._element.parentNode) {
|
|
135
|
+
this._element.parentNode.removeChild(this._element);
|
|
136
|
+
}
|
|
137
|
+
this._element = null;
|
|
138
|
+
}
|
|
110
139
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"GraphStateElement":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"../../../model","name":"GraphSetting","line":21,"character":47},{"__symbolic":"reference","name":"number"},{"__symbolic":"reference","name":"number"},{"__symbolic":"reference","module":"../../../config","name":"GraphStore","line":24,"character":37},{"__symbolic":"reference","module":"../../../logger","name":"LoggerService","line":25,"character":33},{"__symbolic":"reference","name":"number"},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","module":"../../../model/switch-indicator-light/indicator-light-fault-flicker","name":"IndicatorLightFaultFlicker","line":27,"character":41}]}]}],"switchToState":[{"__symbolic":"method"}],"changeGraph":[{"__symbolic":"method"}],"getImageElement":[{"__symbolic":"method"}],"removeImageElement":[{"__symbolic":"method"}],"doFaultFlicker":[{"__symbolic":"method"}],"clearFlickerInterval":[{"__symbolic":"method"}]}}}}]
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"GraphStateElement":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"../../../model","name":"GraphSetting","line":21,"character":47},{"__symbolic":"reference","name":"number"},{"__symbolic":"reference","name":"number"},{"__symbolic":"reference","module":"../../../config","name":"GraphStore","line":24,"character":37},{"__symbolic":"reference","module":"../../../logger","name":"LoggerService","line":25,"character":33},{"__symbolic":"reference","name":"number"},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","module":"../../../model/switch-indicator-light/indicator-light-fault-flicker","name":"IndicatorLightFaultFlicker","line":27,"character":41}]}]}],"switchToState":[{"__symbolic":"method"}],"changeGraph":[{"__symbolic":"method"}],"getImageElement":[{"__symbolic":"method"}],"removeImageElement":[{"__symbolic":"method"}],"doFaultFlicker":[{"__symbolic":"method"}],"clearFlickerInterval":[{"__symbolic":"method"}],"dispose":[{"__symbolic":"method"}]}}}}]
|
|
@@ -24,6 +24,7 @@ export declare class SwitchIndicatorLightElement extends ConditionalEnableElemen
|
|
|
24
24
|
private restorationTimer;
|
|
25
25
|
private isWriteRestorationDownValue;
|
|
26
26
|
private onDocMouseUp;
|
|
27
|
+
private indicatorLightSubscription;
|
|
27
28
|
constructor(element: HTMLElement, injector: Injector, modalService: BsModalService, variableCommunicator: VariableCommunicator, graphStore: GraphStore, permissionChecker: PermissionChecker, operationRecordService: OperationRecordService, securityChecker: SecurityChecker, variableStore: VariableStore, localization: Localization, signalRAppId: string);
|
|
28
29
|
handleMouseUp(): void;
|
|
29
30
|
private initOnDocMouseUpEvent;
|
|
@@ -36,4 +37,5 @@ export declare class SwitchIndicatorLightElement extends ConditionalEnableElemen
|
|
|
36
37
|
private switchToState;
|
|
37
38
|
private initGraphAndText;
|
|
38
39
|
private checkState;
|
|
40
|
+
dispose(): void;
|
|
39
41
|
}
|
|
@@ -208,7 +208,7 @@ export class SwitchIndicatorLightElement extends ConditionalEnableElement {
|
|
|
208
208
|
default:
|
|
209
209
|
throw new Error(`Unknown switchType:${settings.type}`);
|
|
210
210
|
}
|
|
211
|
-
this.indicatorLightOperator.currentStateIdChanged.subscribe(statusIdValue => {
|
|
211
|
+
this.indicatorLightSubscription = this.indicatorLightOperator.currentStateIdChanged.subscribe(statusIdValue => {
|
|
212
212
|
this.currentStateIdChange(statusIdValue);
|
|
213
213
|
});
|
|
214
214
|
this.indicatorLightOperator.requestData(this.signalRAppId);
|
|
@@ -249,4 +249,28 @@ export class SwitchIndicatorLightElement extends ConditionalEnableElement {
|
|
|
249
249
|
throw new Error('The switch indicator light\'s states must greater than 2.');
|
|
250
250
|
}
|
|
251
251
|
}
|
|
252
|
+
dispose() {
|
|
253
|
+
// 清理 document 级别的事件监听器
|
|
254
|
+
if (this.onDocMouseUp) {
|
|
255
|
+
document.removeEventListener(this.isMobileMode ? 'touchend' : 'mouseup', this.onDocMouseUp);
|
|
256
|
+
}
|
|
257
|
+
// 清理定时器
|
|
258
|
+
if (this.restorationTimer) {
|
|
259
|
+
clearTimeout(this.restorationTimer);
|
|
260
|
+
this.restorationTimer = undefined;
|
|
261
|
+
}
|
|
262
|
+
// 清理 indicatorLightOperator 订阅
|
|
263
|
+
if (this.indicatorLightSubscription) {
|
|
264
|
+
this.indicatorLightSubscription.unsubscribe();
|
|
265
|
+
}
|
|
266
|
+
// 清理图形元素(释放 SVG 内存)
|
|
267
|
+
if (this.graphStateElement) {
|
|
268
|
+
this.graphStateElement.dispose();
|
|
269
|
+
}
|
|
270
|
+
// 清理文本元素
|
|
271
|
+
if (this.textStateElement) {
|
|
272
|
+
// TextStateElement 可能也需要 dispose,暂时先清理引用
|
|
273
|
+
this.textStateElement = null;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
252
276
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"SwitchIndicatorLightElement":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"../base/conditional-enable-element","name":"ConditionalEnableElement","line":32,"character":49},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Could not resolve type","line":
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"SwitchIndicatorLightElement":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"../base/conditional-enable-element","name":"ConditionalEnableElement","line":32,"character":49},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Could not resolve type","line":51,"character":25,"context":{"typeName":"HTMLElement"}},{"__symbolic":"reference","module":"@angular/core","name":"Injector","line":52,"character":18},{"__symbolic":"reference","module":"ngx-bootstrap/modal","name":"BsModalService","line":53,"character":39},{"__symbolic":"reference","module":"../../communication","name":"VariableCommunicator","line":54,"character":30},{"__symbolic":"reference","module":"../../config","name":"GraphStore","line":55,"character":37},{"__symbolic":"reference","module":"../../service","name":"PermissionChecker","line":56,"character":27},{"__symbolic":"reference","module":"../../service","name":"OperationRecordService","line":57,"character":49},{"__symbolic":"reference","module":"../../security","name":"SecurityChecker","line":58,"character":42},{"__symbolic":"reference","module":"../../config","name":"VariableStore","line":59,"character":23},{"__symbolic":"reference","module":"../../localization","name":"Localization","line":60,"character":22},{"__symbolic":"reference","name":"string"}]}],"handleMouseUp":[{"__symbolic":"method"}],"initOnDocMouseUpEvent":[{"__symbolic":"method"}],"checkElementPassword":[{"__symbolic":"method"}],"doSwitchOperator":[{"__symbolic":"method"}],"writeValue":[{"__symbolic":"method"}],"initSwitchOperator":[{"__symbolic":"method"}],"initIndictorLightOperator":[{"__symbolic":"method"}],"currentStateIdChange":[{"__symbolic":"method"}],"switchToState":[{"__symbolic":"method"}],"initGraphAndText":[{"__symbolic":"method"}],"checkState":[{"__symbolic":"method"}],"dispose":[{"__symbolic":"method"}]}}}}]
|
package/package.json
CHANGED
package/shared/gui-consts.d.ts
CHANGED
package/shared/gui-consts.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"GuiConsts":{"__symbolic":"class","statics":{"components":{"imageKey":"Image","numericalDisplayKey":"NumericalDisplay","textKey":"Text","hyperlinkKey":"Hyperlink","meterKey":"Meter","pipeKey":"Pipe","switchIndicatorLightKey":"SwitchIndicatorLight","barGraphKey":"BarGraph","toggleViewKey":"ToggleView","characterKey":"Character","straightLineKey":"StraightLine","polyLineKey":"PolyLine","rectangleKey":"Rectangle","sectorkey":"Sector","ellipseKey":"Ellipse","datetimeDisplayKey":"DatetimeDisplay","historicalCurveKey":"HistoricalCurve","ringGraphKey":"RingGraph","viewOperationElement":"ViewOperation","polygonKey":"Polygon","videokey":"Video","tableKey":"Table","weatherKey":"Weather","airQualityKey":"AirQualityIndex","alarmKey":"Alarm"
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"GuiConsts":{"__symbolic":"class","statics":{"components":{"imageKey":"Image","numericalDisplayKey":"NumericalDisplay","textKey":"Text","hyperlinkKey":"Hyperlink","meterKey":"Meter","pipeKey":"Pipe","switchIndicatorLightKey":"SwitchIndicatorLight","barGraphKey":"BarGraph","toggleViewKey":"ToggleView","characterKey":"Character","straightLineKey":"StraightLine","polyLineKey":"PolyLine","rectangleKey":"Rectangle","sectorkey":"Sector","ellipseKey":"Ellipse","datetimeDisplayKey":"DatetimeDisplay","historicalCurveKey":"HistoricalCurve","ringGraphKey":"RingGraph","viewOperationElement":"ViewOperation","polygonKey":"Polygon","videokey":"Video","tableKey":"Table","weatherKey":"Weather","airQualityKey":"AirQualityIndex","alarmKey":"Alarm"}}}}}]
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { Injector } from '@angular/core';
|
|
2
|
-
import { PermissionChecker } from '../../service';
|
|
3
|
-
import { VariableCommunicator } from '../../communication';
|
|
4
|
-
import { ConditionalDynamicDisplayElement } from '../base/conditional-dynamic-display-element';
|
|
5
|
-
import { ScrollAlarmModel } from '../../model/scroll-alarm/scroll-alarm.model';
|
|
6
|
-
import { AlarmsStore, VariableStore } from '../../config';
|
|
7
|
-
export declare class ScrollAlarmElement extends ConditionalDynamicDisplayElement {
|
|
8
|
-
private readonly alarmsStore;
|
|
9
|
-
readonly model: ScrollAlarmModel;
|
|
10
|
-
private readonly logger;
|
|
11
|
-
readonly variableCommunicator: VariableCommunicator;
|
|
12
|
-
private elementStatus;
|
|
13
|
-
private element;
|
|
14
|
-
private scrollIntervalId;
|
|
15
|
-
private alarmNames;
|
|
16
|
-
private startTime;
|
|
17
|
-
private endTime;
|
|
18
|
-
private getAlarmDataId;
|
|
19
|
-
private isScrolling;
|
|
20
|
-
private isDisposed;
|
|
21
|
-
private currentPage;
|
|
22
|
-
private maxResultCount;
|
|
23
|
-
private displayedItems;
|
|
24
|
-
private pageWidths;
|
|
25
|
-
private totalWidth;
|
|
26
|
-
private container;
|
|
27
|
-
private allAlarmsContainer;
|
|
28
|
-
private currentLeft;
|
|
29
|
-
private autoCycle;
|
|
30
|
-
private hasMoreData;
|
|
31
|
-
private isLoadingNextPage;
|
|
32
|
-
private headerFont;
|
|
33
|
-
private fontString;
|
|
34
|
-
constructor(element: HTMLElement, injector: Injector, permissionChecker: PermissionChecker, variableCommunicator: VariableCommunicator, variableStore: VariableStore, alarmsStore: AlarmsStore, signalRAppId: string);
|
|
35
|
-
dispose(): void;
|
|
36
|
-
private getAlarmData;
|
|
37
|
-
private initDisplayContainer;
|
|
38
|
-
private renderNewPage;
|
|
39
|
-
private removeOldestPage;
|
|
40
|
-
private resetToFirstPage;
|
|
41
|
-
private scrollContent;
|
|
42
|
-
private initScrolling;
|
|
43
|
-
private pauseScroll;
|
|
44
|
-
private resumeScroll;
|
|
45
|
-
private updateQueryTimeRange;
|
|
46
|
-
private setStatusAsNormal;
|
|
47
|
-
private setStatusAsLoading;
|
|
48
|
-
private renderStatus;
|
|
49
|
-
private clearStatus;
|
|
50
|
-
}
|