@flexem/fc-gui 3.0.0-alpha.120 → 3.0.0-alpha.122

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.
@@ -298,7 +298,7 @@ export class MainElement {
298
298
  each(this.elements, e => {
299
299
  if (e instanceof HistoricalCurveElement || e instanceof VideoElement
300
300
  || e instanceof WeatherElement || e instanceof NumericalDisplayElement || e instanceof TextElement
301
- || e instanceof AirQualityElement) {
301
+ || e instanceof AirQualityElement || e instanceof SwitchIndicatorLightElement) {
302
302
  e.dispose();
303
303
  }
304
304
  });
@@ -24,4 +24,5 @@ export declare class GraphStateElement {
24
24
  private removeImageElement;
25
25
  private doFaultFlicker;
26
26
  private clearFlickerInterval;
27
+ dispose(): void;
27
28
  }
@@ -107,4 +107,22 @@ export class GraphStateElement {
107
107
  }
108
108
  }
109
109
  }
110
+ dispose() {
111
+ // 清理定时器
112
+ if (this.faultFlickerInterval) {
113
+ clearInterval(this.faultFlickerInterval);
114
+ this.faultFlickerInterval = undefined;
115
+ }
116
+ // 移除图片元素
117
+ this.removeImageElement();
118
+ // 清理图形缓存
119
+ if (this.graphs) {
120
+ this.graphs.clear();
121
+ }
122
+ // 清理 SVG 元素
123
+ if (this._element && this._element.parentNode) {
124
+ this._element.parentNode.removeChild(this._element);
125
+ }
126
+ this._element = null;
127
+ }
110
128
  }
@@ -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":50,"character":25,"context":{"typeName":"HTMLElement"}},{"__symbolic":"reference","module":"@angular/core","name":"Injector","line":51,"character":18},{"__symbolic":"reference","module":"ngx-bootstrap/modal","name":"BsModalService","line":52,"character":39},{"__symbolic":"reference","module":"../../communication","name":"VariableCommunicator","line":53,"character":30},{"__symbolic":"reference","module":"../../config","name":"GraphStore","line":54,"character":37},{"__symbolic":"reference","module":"../../service","name":"PermissionChecker","line":55,"character":27},{"__symbolic":"reference","module":"../../service","name":"OperationRecordService","line":56,"character":49},{"__symbolic":"reference","module":"../../security","name":"SecurityChecker","line":57,"character":42},{"__symbolic":"reference","module":"../../config","name":"VariableStore","line":58,"character":23},{"__symbolic":"reference","module":"../../localization","name":"Localization","line":59,"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"}]}}}}]
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "main": "bundles/fc-gui.umd.js",
3
- "version": "3.0.0-alpha.120",
3
+ "version": "3.0.0-alpha.122",
4
4
  "module": "public_api.js",
5
5
  "typings": "public_api.d.ts",
6
6
  "license": "UNLICENSED",