@flexem/fc-gui 3.0.0-alpha.13 → 3.0.0-alpha.131

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.
Files changed (184) hide show
  1. package/CHANGELOG.md +439 -1
  2. package/assets/img/black_first_page.png +0 -0
  3. package/assets/img/black_last_page.png +0 -0
  4. package/assets/img/black_next_page.png +0 -0
  5. package/assets/img/black_previous_page.png +0 -0
  6. package/bundles/@flexem/fc-gui.umd.js +38522 -34542
  7. package/bundles/@flexem/fc-gui.umd.js.map +1 -1
  8. package/bundles/@flexem/fc-gui.umd.min.js +5 -5
  9. package/bundles/@flexem/fc-gui.umd.min.js.map +1 -1
  10. package/communication/variable/variable-communicator.d.ts +4 -0
  11. package/communication/variable/variable-value.d.ts +4 -1
  12. package/communication/variable/variable-value.js +4 -1
  13. package/communication/variable/variable-value.metadata.json +1 -1
  14. package/config/alarm/alarm.store.d.ts +6 -0
  15. package/config/alarm/alarm.store.js +0 -0
  16. package/config/alarm/alarm.store.metadata.json +1 -0
  17. package/config/alarm/get-alarms-args.d.ts +12 -0
  18. package/config/alarm/get-alarms-args.js +13 -0
  19. package/config/alarm/get-alarms-args.metadata.json +1 -0
  20. package/config/alarm/index.d.ts +2 -0
  21. package/config/alarm/index.js +1 -0
  22. package/config/alarm/index.metadata.json +1 -0
  23. package/config/config-store.d.ts +2 -0
  24. package/config/history-data/get-history-data-args.d.ts +14 -3
  25. package/config/history-data/get-history-data-args.js +5 -3
  26. package/config/history-data/get-history-data-args.metadata.json +1 -1
  27. package/config/history-data/history-data.model.d.ts +7 -1
  28. package/config/history-data/history-data.model.js +9 -1
  29. package/config/history-data/history-data.model.metadata.json +1 -1
  30. package/config/history-data/index.d.ts +1 -1
  31. package/config/history-data/index.js +1 -1
  32. package/config/history-data/index.metadata.json +1 -1
  33. package/config/index.d.ts +1 -0
  34. package/config/index.js +1 -0
  35. package/config/index.metadata.json +1 -1
  36. package/elements/air-quality/air-quality-element.d.ts +31 -0
  37. package/elements/air-quality/air-quality-element.js +194 -0
  38. package/elements/air-quality/air-quality-element.metadata.json +1 -0
  39. package/elements/alarm/alarm-element.d.ts +69 -0
  40. package/elements/alarm/alarm-element.js +497 -0
  41. package/elements/alarm/alarm-element.metadata.json +1 -0
  42. package/elements/bar-graph-element.d.ts +10 -2
  43. package/elements/bar-graph-element.js +135 -5
  44. package/elements/bar-graph-element.metadata.json +1 -1
  45. package/elements/base/readable-element.d.ts +6 -1
  46. package/elements/base/readable-element.js +64 -2
  47. package/elements/base/readable-element.metadata.json +1 -1
  48. package/elements/base/state-control-element.d.ts +3 -1
  49. package/elements/base/state-control-element.js +3 -0
  50. package/elements/datetime-display/datetime-display-element.d.ts +1 -0
  51. package/elements/datetime-display/datetime-display-element.js +10 -2
  52. package/elements/datetime-display/datetime-display-element.metadata.json +1 -1
  53. package/elements/datetime-display/time-zone-select-json.d.ts +8 -0
  54. package/elements/datetime-display/time-zone-select-json.js +558 -0
  55. package/elements/historical-curve/historical-curve.element.d.ts +39 -3
  56. package/elements/historical-curve/historical-curve.element.js +509 -43
  57. package/elements/historical-curve/historical-curve.element.metadata.json +1 -1
  58. package/elements/main-element.d.ts +1 -0
  59. package/elements/main-element.js +59 -9
  60. package/elements/main-element.metadata.json +1 -1
  61. package/elements/meter-element.d.ts +7 -1
  62. package/elements/meter-element.js +76 -7
  63. package/elements/meter-element.metadata.json +1 -1
  64. package/elements/numerical-display/numerical-display-element.d.ts +16 -3
  65. package/elements/numerical-display/numerical-display-element.js +83 -11
  66. package/elements/numerical-display/numerical-display-element.metadata.json +1 -1
  67. package/elements/per-view-variable-communicator.d.ts +3 -0
  68. package/elements/per-view-variable-communicator.js +11 -0
  69. package/elements/per-view-variable-communicator.metadata.json +1 -1
  70. package/elements/ring-graph/ring-graph-element.d.ts +13 -1
  71. package/elements/ring-graph/ring-graph-element.js +164 -3
  72. package/elements/ring-graph/ring-graph-element.metadata.json +1 -1
  73. package/elements/scroll-alarm/scroll-alarm-element.d.ts +67 -0
  74. package/elements/scroll-alarm/scroll-alarm-element.js +663 -0
  75. package/elements/scroll-alarm/scroll-alarm-element.metadata.json +1 -0
  76. package/elements/shared/graph/graph-state-element.js +0 -3
  77. package/elements/shared/text/text-element.d.ts +9 -0
  78. package/elements/shared/text/text-element.js +33 -2
  79. package/elements/shared/text/text-element.metadata.json +1 -1
  80. package/elements/shared/text/text-state-element.d.ts +25 -2
  81. package/elements/shared/text/text-state-element.js +138 -63
  82. package/elements/shared/text/text-state-element.metadata.json +1 -1
  83. package/elements/static-elements/hyperlink-element.d.ts +24 -2
  84. package/elements/static-elements/hyperlink-element.js +101 -3
  85. package/elements/static-elements/hyperlink-element.metadata.json +1 -1
  86. package/elements/static-elements/text-element.d.ts +23 -2
  87. package/elements/static-elements/text-element.js +96 -3
  88. package/elements/static-elements/text-element.metadata.json +1 -1
  89. package/elements/switch-indicator-light/bit-switch-operator.d.ts +1 -0
  90. package/elements/switch-indicator-light/bit-switch-operator.js +19 -0
  91. package/elements/switch-indicator-light/bit-switch-operator.metadata.json +1 -1
  92. package/elements/switch-indicator-light/switch-indicator-light-element.d.ts +18 -2
  93. package/elements/switch-indicator-light/switch-indicator-light-element.js +120 -25
  94. package/elements/switch-indicator-light/switch-indicator-light-element.metadata.json +1 -1
  95. package/elements/switch-indicator-light/switch-operator.d.ts +1 -0
  96. package/elements/switch-indicator-light/word-switch-operator.d.ts +1 -0
  97. package/elements/switch-indicator-light/word-switch-operator.js +6 -0
  98. package/elements/switch-indicator-light/word-switch-operator.metadata.json +1 -1
  99. package/elements/video/video-element.d.ts +4 -0
  100. package/elements/video/video-element.js +81 -21
  101. package/elements/video/video-element.metadata.json +1 -1
  102. package/elements/view-operation/view-operation.element.d.ts +23 -2
  103. package/elements/view-operation/view-operation.element.js +103 -1
  104. package/elements/view-operation/view-operation.element.metadata.json +1 -1
  105. package/elements/weather/weater-element.js +0 -1
  106. package/gui/gui-context.d.ts +12 -2
  107. package/gui/gui-host.d.ts +1 -1
  108. package/gui/gui-view.d.ts +2 -0
  109. package/gui/gui-view.js +38 -2
  110. package/gui/gui-view.metadata.json +1 -1
  111. package/gui/gui.component.d.ts +3 -0
  112. package/gui/gui.component.js +15 -2
  113. package/gui/gui.component.metadata.json +1 -1
  114. package/localization/localization.service.d.ts +7 -0
  115. package/localization/localization.service.js +10 -3
  116. package/localization/localization.service.metadata.json +1 -1
  117. package/localization/localization.service.zh_CN.js +8 -1
  118. package/localization/localization.service.zh_CN.metadata.json +1 -1
  119. package/modal/write-value/write-value-modal-args.d.ts +5 -1
  120. package/modal/write-value/write-value-modal-args.js +3 -1
  121. package/modal/write-value/write-value-modal-args.metadata.json +1 -1
  122. package/modal/write-value/write-value-modal.component.d.ts +12 -7
  123. package/modal/write-value/write-value-modal.component.html +9 -4
  124. package/modal/write-value/write-value-modal.component.js +73 -15
  125. package/modal/write-value/write-value-modal.component.metadata.json +1 -1
  126. package/model/air-quality/air-quality-info.d.ts +23 -0
  127. package/model/air-quality/air-quality-info.js +4 -0
  128. package/model/air-quality/air-quality-info.metadata.json +1 -0
  129. package/model/air-quality/air-quality.model.d.ts +7 -0
  130. package/model/air-quality/air-quality.model.js +0 -0
  131. package/model/air-quality/air-quality.model.metadata.json +1 -0
  132. package/model/alarm/alarm.model.d.ts +13 -0
  133. package/model/alarm/alarm.model.js +0 -0
  134. package/model/alarm/alarm.model.metadata.json +1 -0
  135. package/model/bar-graph/bar-graph.d.ts +4 -0
  136. package/model/base/font-setting-model.d.ts +6 -0
  137. package/model/base/font-setting-model.metadata.json +1 -1
  138. package/model/base/readable-model.d.ts +4 -0
  139. package/model/datetime-display/datetime-display.d.ts +1 -0
  140. package/model/historical-curve/historical-curve-axis-settings.d.ts +11 -0
  141. package/model/historical-curve/historical-curve-axis-settings.js +5 -0
  142. package/model/historical-curve/historical-curve-axis-settings.metadata.json +1 -1
  143. package/model/historical-curve/historical-curve-chanel.model.d.ts +8 -0
  144. package/model/historical-curve/historical-curve.data-settings.d.ts +18 -1
  145. package/model/historical-curve/historical-curve.data-settings.metadata.json +1 -1
  146. package/model/meter/meter.d.ts +4 -0
  147. package/model/ring-graph/ring-graph.model.d.ts +8 -0
  148. package/model/scroll-alarm/scroll-alarm.model.d.ts +21 -0
  149. package/model/scroll-alarm/scroll-alarm.model.js +0 -0
  150. package/model/scroll-alarm/scroll-alarm.model.metadata.json +1 -0
  151. package/model/switch-indicator-light/bit-switch-operation.d.ts +2 -1
  152. package/model/switch-indicator-light/bit-switch-operation.js +1 -0
  153. package/model/switch-indicator-light/bit-switch-operation.metadata.json +1 -1
  154. package/model/switch-indicator-light/switch-indicator-light.d.ts +2 -0
  155. package/model/view-operation/view-operation-element.model.d.ts +7 -1
  156. package/package.json +1 -1
  157. package/public_api.js +1 -0
  158. package/remote/communication/variable/remote-variable-communicator.d.ts +22 -0
  159. package/remote/communication/variable/remote-variable-communicator.js +122 -2
  160. package/remote/communication/variable/remote-variable-communicator.metadata.json +1 -1
  161. package/remote/communication/variable/remote-variable-protocol.d.ts +5 -0
  162. package/service/index.d.ts +4 -0
  163. package/service/index.js +1 -0
  164. package/service/index.metadata.json +1 -1
  165. package/service/language.service.d.ts +37 -0
  166. package/service/language.service.js +0 -0
  167. package/service/language.service.metadata.json +1 -0
  168. package/service/released-variable/index.d.ts +1 -0
  169. package/service/released-variable/index.js +0 -0
  170. package/service/released-variable/index.metadata.json +1 -0
  171. package/service/released-variable/released-variable.service.d.ts +4 -0
  172. package/service/released-variable/released-variable.service.js +0 -0
  173. package/service/released-variable/released-variable.service.metadata.json +1 -0
  174. package/service/system-text-library.service.d.ts +76 -0
  175. package/service/system-text-library.service.js +28 -0
  176. package/service/system-text-library.service.metadata.json +1 -0
  177. package/service/text-library.service.d.ts +49 -0
  178. package/service/text-library.service.js +0 -0
  179. package/service/text-library.service.metadata.json +1 -0
  180. package/service/weather.service.d.ts +1 -0
  181. package/shared/gui-consts.d.ts +3 -0
  182. package/shared/gui-consts.js +3 -0
  183. package/shared/gui-consts.metadata.json +1 -1
  184. package/utils/data-type/fbox-data-type.service.js +40 -0
@@ -22,4 +22,12 @@ export interface RingGraphModel extends ConditionalDisplayModel {
22
22
  readonly alarmRange?: AlarmRangeModel;
23
23
  readonly showPercentage: boolean;
24
24
  readonly percentageFont?: Font;
25
+ readonly minVariable?: any;
26
+ readonly maxVariable?: any;
27
+ readonly minValueType?: any;
28
+ readonly maxValueType?: any;
29
+ readonly masterDivisionNumber: number;
30
+ readonly subDivisionNumber: number;
31
+ readonly integerDigits: number;
32
+ readonly fractionDigits: number;
25
33
  }
@@ -0,0 +1,21 @@
1
+ import { ConditionalDynamicDisplayModel } from '../base/conditional-dynamic-display-model';
2
+ import { Point, Size } from '../shared';
3
+ import { DynamicDisplayModel } from '../shared/dynamic-display/dynamic-display-model';
4
+ export interface ScrollAlarmModel extends ConditionalDynamicDisplayModel {
5
+ readonly version: number;
6
+ readonly size: Size;
7
+ readonly location: Point;
8
+ readonly generalSetting?: any;
9
+ readonly filterSetting?: any;
10
+ readonly widths: number[];
11
+ readonly heights: number[];
12
+ readonly columLabels: string[];
13
+ readonly levelText: string[];
14
+ readonly scrollSetting?: {
15
+ readonly scrollInterval?: number;
16
+ readonly scrollDirection?: 'vertical' | 'horizontal';
17
+ readonly pauseOnHover?: boolean;
18
+ readonly autoPlay?: boolean;
19
+ };
20
+ readonly dynamicSetting?: DynamicDisplayModel;
21
+ }
File without changes
@@ -0,0 +1 @@
1
+ [{"__symbolic":"module","version":4,"metadata":{"ScrollAlarmModel":{"__symbolic":"interface"}}}]
@@ -1,5 +1,6 @@
1
1
  export declare enum BitSwitchOperation {
2
2
  On = 0,
3
3
  Off = 1,
4
- Inverse = 2
4
+ Inverse = 2,
5
+ Restoration = 3
5
6
  }
@@ -3,4 +3,5 @@ export var BitSwitchOperation;
3
3
  BitSwitchOperation[BitSwitchOperation["On"] = 0] = "On";
4
4
  BitSwitchOperation[BitSwitchOperation["Off"] = 1] = "Off";
5
5
  BitSwitchOperation[BitSwitchOperation["Inverse"] = 2] = "Inverse";
6
+ BitSwitchOperation[BitSwitchOperation["Restoration"] = 3] = "Restoration";
6
7
  })(BitSwitchOperation || (BitSwitchOperation = {}));
@@ -1 +1 @@
1
- [{"__symbolic":"module","version":4,"metadata":{"BitSwitchOperation":{"On":0,"Off":1,"Inverse":2}}}]
1
+ [{"__symbolic":"module","version":4,"metadata":{"BitSwitchOperation":{"On":0,"Off":1,"Inverse":2,"Restoration":3}}}]
@@ -5,6 +5,7 @@ import { ConditionalEnableModel } from '../base/conditional-enable-model';
5
5
  import { ConditionItemModel, GraphSetting, Point, Size } from '../shared';
6
6
  import { DynamicDisplayModel } from '../shared/dynamic-display/dynamic-display-model';
7
7
  import { SecurityModel } from '../base/security-model';
8
+ import { TextLibrarySetting } from '../base/font-setting-model';
8
9
  export interface SwitchIndicatorLight extends ConditionalEnableModel, SecurityModel {
9
10
  /**
10
11
  * @type {(number)}
@@ -30,4 +31,5 @@ export interface SwitchIndicatorLight extends ConditionalEnableModel, SecurityMo
30
31
  readonly isAwaysEnable?: boolean;
31
32
  readonly enableItems?: ConditionItemModel[];
32
33
  readonly fixedPositionType?: number;
34
+ readonly textLibrary?: TextLibrarySetting;
33
35
  }
@@ -2,12 +2,14 @@ import { Size, Text, GraphSetting } from '../shared';
2
2
  import { ConditionalEnableModel } from '../base/conditional-enable-model';
3
3
  import { SecurityModel } from '../base';
4
4
  import { ViewOperationType } from './view-operation-type';
5
+ import { TextLibrarySetting } from '../base/font-setting-model';
5
6
  export interface ViewOperationElementModel extends ConditionalEnableModel, SecurityModel {
6
7
  /**
7
8
  * 版本 2 : 动态行为调整
8
9
  * 版本 3 :使能控制调整
9
10
  * 版本 4 :新增操作记录
10
- * 版本 5 :新增页面操作类型,之前类型都为“切换页面”
11
+ * 版本 5 :新增页面操作类型,之前类型都为"切换页面"
12
+ * 版本 6 :新增文本库支持
11
13
  */
12
14
  readonly version?: number;
13
15
  readonly viewIndex?: number;
@@ -16,4 +18,8 @@ export interface ViewOperationElementModel extends ConditionalEnableModel, Secur
16
18
  readonly useGraph: boolean;
17
19
  readonly graphSetting: GraphSetting;
18
20
  readonly operationType: ViewOperationType;
21
+ /**
22
+ * 文本库配置(版本6新增)
23
+ */
24
+ readonly textLibrary?: TextLibrarySetting;
19
25
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "main": "bundles/fc-gui.umd.js",
3
- "version": "3.0.0-alpha.13",
3
+ "version": "3.0.0-alpha.131",
4
4
  "module": "public_api.js",
5
5
  "typings": "public_api.d.ts",
6
6
  "license": "UNLICENSED",
package/public_api.js CHANGED
@@ -8,4 +8,5 @@ export * from './localization';
8
8
  export * from './shared';
9
9
  export { GuiModule } from './gui.module';
10
10
  export * from './remote';
11
+ export * from './service';
11
12
  export { LOGGER_SERVICE_TOKEN, ConsoleLoggerService } from './logger';
@@ -9,6 +9,7 @@ export declare class RemoteVariableCommunicator implements VariableCommunicator
9
9
  private appIdVariablesMap;
10
10
  private connectedSubscription;
11
11
  private variableValuesChangedSubscription;
12
+ private virtualDeviceStatesChangedSubscription;
12
13
  private variablesToBeOpened;
13
14
  private variablesToBeClosed;
14
15
  private variableValueCache;
@@ -17,14 +18,35 @@ export declare class RemoteVariableCommunicator implements VariableCommunicator
17
18
  private variableStateCache;
18
19
  private variableStatesToBeOpened;
19
20
  private variableStatesToBeClosed;
21
+ private alarmObservers;
22
+ private alarmChangedSubscription;
23
+ private systemVariableHandlers;
20
24
  constructor(remoteVariableProtocol: RemoteVariableProtocol, logger: LoggerService);
25
+ private doAlarmChanged;
21
26
  private doVariableValuesChanged;
27
+ private doVirtualDeviceStatesChanged;
22
28
  private doVariableStatesChanged;
23
29
  subscribeVariableStates(variableNames: string[]): Observable<VariableState[]>;
24
30
  subscribeVariableState(variableName: string): Observable<VariableState>;
31
+ requestVirtualDeviceState(): Observable<void>;
25
32
  openVariables(variableNames: string[], appId?: string): Observable<VariableValue[]>;
26
33
  openVariable(variableName: string, appId?: string): Observable<VariableValue>;
27
34
  write(variableName: string, value: any): Observable<VariableValue>;
28
35
  writeWordByBit(variableName: string, index: number, value: number): Observable<VariableValue>;
36
+ subscribeUserDeviceAlarms(appId?: string): Observable<any[]>;
37
+ /**
38
+ * 注册系统变量处理器
39
+ * @param variableName 变量名(如"当前语种ID")
40
+ * @param getValue 获取值的函数
41
+ * @param setValue 设置值的函数
42
+ */
43
+ registerSystemVariableHandler(variableName: string, getValue: () => Promise<any>, setValue: (value: any) => Promise<void>): void;
44
+ /**
45
+ * 通知系统变量值变化
46
+ * 用于在系统变量值改变时通知所有订阅者
47
+ * @param variableName 变量名
48
+ * @param value 新值
49
+ */
50
+ notifySystemVariableChange(variableName: string, value: any): void;
29
51
  dispose(): void;
30
52
  }
@@ -10,6 +10,9 @@ export class RemoteVariableCommunicator {
10
10
  this.appIdVariablesMap = new Map();
11
11
  this.variableStateObservers = new Map();
12
12
  this.variableStateCache = new Map();
13
+ this.alarmObservers = [];
14
+ // 系统变量处理器
15
+ this.systemVariableHandlers = new Map();
13
16
  this.variableValueCache = new StringifyingMap(k => JSON.stringify(k));
14
17
  this.connectedSubscription = this.remoteVariableProtocol.connected.subscribe(() => {
15
18
  const variableNamesToStart = [];
@@ -23,6 +26,18 @@ export class RemoteVariableCommunicator {
23
26
  });
24
27
  this.doVariableStatesChanged();
25
28
  this.doVariableValuesChanged();
29
+ this.doVirtualDeviceStatesChanged();
30
+ this.doAlarmChanged();
31
+ }
32
+ doAlarmChanged() {
33
+ if (this.alarmChangedSubscription !== undefined) {
34
+ this.alarmChangedSubscription.unsubscribe();
35
+ }
36
+ this.alarmChangedSubscription = this.remoteVariableProtocol.virtualDeviceAlarmsChanged.subscribe((alarms) => {
37
+ each(this.alarmObservers, ob => {
38
+ ob.next(alarms);
39
+ });
40
+ });
26
41
  }
27
42
  doVariableValuesChanged() {
28
43
  if (this.variableValuesChangedSubscription !== undefined) {
@@ -42,6 +57,25 @@ export class RemoteVariableCommunicator {
42
57
  });
43
58
  });
44
59
  }
60
+ doVirtualDeviceStatesChanged() {
61
+ if (this.virtualDeviceStatesChangedSubscription !== undefined) {
62
+ this.virtualDeviceStatesChangedSubscription.unsubscribe();
63
+ }
64
+ this.virtualDeviceStatesChangedSubscription =
65
+ this.remoteVariableProtocol.virtualDeviceStatesChanged.subscribe((deviceStates) => {
66
+ each(deviceStates, deviceState => {
67
+ const variableName = '设备状态';
68
+ this.variableValueCache.set(variableName, deviceState);
69
+ const data = Object.assign(Object.assign({}, deviceState), { systemName: '设备状态' });
70
+ if (this.observers.has(variableName)) {
71
+ each(this.observers.get(variableName), ob => {
72
+ // TODO 同一个ob监听多个变量的情况,组合成数组一次推送。
73
+ ob.next([data]);
74
+ });
75
+ }
76
+ });
77
+ });
78
+ }
45
79
  doVariableStatesChanged() {
46
80
  if (this.variableStatesChangedSubscription !== undefined) {
47
81
  this.variableStatesChangedSubscription.unsubscribe();
@@ -115,6 +149,9 @@ export class RemoteVariableCommunicator {
115
149
  subscribeVariableState(variableName) {
116
150
  return this.subscribeVariableStates([variableName]).pipe(map(values => values[0]));
117
151
  }
152
+ requestVirtualDeviceState() {
153
+ return this.remoteVariableProtocol.requestVirtualDeviceState();
154
+ }
118
155
  openVariables(variableNames, appId = '') {
119
156
  return new Observable(observer => {
120
157
  let variablesToStart = [];
@@ -140,7 +177,33 @@ export class RemoteVariableCommunicator {
140
177
  }
141
178
  }
142
179
  });
143
- variablesToStart = uniq(variablesToStart);
180
+ // 过滤掉系统变量,它们不需要通过SignalR订阅
181
+ const normalVariables = variablesToStart.filter(v => !this.systemVariableHandlers.has(v));
182
+ const systemVariables = variablesToStart.filter(v => this.systemVariableHandlers.has(v));
183
+ // 处理系统变量的初始值
184
+ systemVariables.forEach(variableName => {
185
+ const handler = this.systemVariableHandlers.get(variableName);
186
+ if (handler && handler.getValue) {
187
+ void handler.getValue().then(value => {
188
+ const variableValue = {
189
+ variableName: variableName,
190
+ value: value,
191
+ state: 1 // Normal state
192
+ };
193
+ this.variableValueCache.set(variableName, variableValue);
194
+ if (this.observers.has(variableName)) {
195
+ each(this.observers.get(variableName), ob => {
196
+ ob.next([variableValue]);
197
+ });
198
+ }
199
+ }).catch(error => {
200
+ if (this.logger) {
201
+ this.logger.error(`[RemoteVariableCommunicator] Failed to get system variable "${variableName}" value:`, error);
202
+ }
203
+ });
204
+ }
205
+ });
206
+ variablesToStart = uniq(normalVariables);
144
207
  if (variablesToStart && variablesToStart.length > 0) {
145
208
  if (!this.variablesToBeOpened) {
146
209
  this.variablesToBeOpened = [];
@@ -185,8 +248,24 @@ export class RemoteVariableCommunicator {
185
248
  }
186
249
  write(variableName, value) {
187
250
  if (!variableName) {
188
- return;
251
+ return new Observable(observer => {
252
+ observer.complete();
253
+ });
189
254
  }
255
+ // 检查是否为系统变量
256
+ if (this.systemVariableHandlers.has(variableName)) {
257
+ const handler = this.systemVariableHandlers.get(variableName);
258
+ // 调用系统变量的setValue处理器
259
+ void handler.setValue(value).catch(error => {
260
+ if (this.logger) {
261
+ this.logger.error('[RemoteVariableCommunicator] Failed to set system variable value:', error);
262
+ }
263
+ });
264
+ return new Observable(__ => {
265
+ /* 系统变量通过自己的机制通知变化 */
266
+ });
267
+ }
268
+ // 普通变量通过SignalR写入
190
269
  this.remoteVariableProtocol.writeVariable(variableName, value);
191
270
  return new Observable(__ => {
192
271
  /* do nothing right now, if want value change immediately, can use this code below:
@@ -203,11 +282,52 @@ export class RemoteVariableCommunicator {
203
282
  observer.next(new VariableValue(variable, VariableStateEnum.DataNormal, value))*/
204
283
  });
205
284
  }
285
+ subscribeUserDeviceAlarms(appId = '') {
286
+ return new Observable(observer => {
287
+ this.alarmObservers.push(observer);
288
+ this.remoteVariableProtocol.subscribeVirtualDeviceAlarms(appId);
289
+ return () => {
290
+ this.remoteVariableProtocol.unsubscribeVirtualDeviceAlarms(appId);
291
+ };
292
+ });
293
+ }
294
+ /**
295
+ * 注册系统变量处理器
296
+ * @param variableName 变量名(如"当前语种ID")
297
+ * @param getValue 获取值的函数
298
+ * @param setValue 设置值的函数
299
+ */
300
+ registerSystemVariableHandler(variableName, getValue, setValue) {
301
+ this.systemVariableHandlers.set(variableName, { getValue, setValue });
302
+ }
303
+ /**
304
+ * 通知系统变量值变化
305
+ * 用于在系统变量值改变时通知所有订阅者
306
+ * @param variableName 变量名
307
+ * @param value 新值
308
+ */
309
+ notifySystemVariableChange(variableName, value) {
310
+ const variableValue = {
311
+ variableName: variableName,
312
+ value: value,
313
+ state: 1 // Normal state
314
+ };
315
+ // 更新缓存
316
+ this.variableValueCache.set(variableName, variableValue);
317
+ // 通知所有订阅者
318
+ if (this.observers.has(variableName)) {
319
+ each(this.observers.get(variableName), ob => {
320
+ ob.next([variableValue]);
321
+ });
322
+ }
323
+ }
206
324
  dispose() {
207
325
  // TODO调用所有的ob.complete()。
208
326
  this.connectedSubscription.unsubscribe();
209
327
  this.variableStatesChangedSubscription.unsubscribe();
210
328
  this.variableValuesChangedSubscription.unsubscribe();
329
+ this.virtualDeviceStatesChangedSubscription.unsubscribe();
330
+ this.alarmChangedSubscription.unsubscribe();
211
331
  if (this.logger && this.logger.isDebugEnabled()) {
212
332
  this.logger.debug('[VariableCommunicator] RemoteVariableCommunicator disposed.');
213
333
  }
@@ -1 +1 @@
1
- [{"__symbolic":"module","version":4,"metadata":{"RemoteVariableCommunicator":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"./remote-variable-protocol","name":"RemoteVariableProtocol","line":24,"character":57},{"__symbolic":"reference","module":"../../../logger","name":"LoggerService","line":24,"character":106}]}],"doVariableValuesChanged":[{"__symbolic":"method"}],"doVariableStatesChanged":[{"__symbolic":"method"}],"subscribeVariableStates":[{"__symbolic":"method"}],"subscribeVariableState":[{"__symbolic":"method"}],"openVariables":[{"__symbolic":"method"}],"openVariable":[{"__symbolic":"method"}],"write":[{"__symbolic":"method"}],"writeWordByBit":[{"__symbolic":"method"}],"dispose":[{"__symbolic":"method"}]}}}}]
1
+ [{"__symbolic":"module","version":4,"metadata":{"RemoteVariableCommunicator":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"./remote-variable-protocol","name":"RemoteVariableProtocol","line":34,"character":57},{"__symbolic":"reference","module":"../../../logger","name":"LoggerService","line":34,"character":106}]}],"doAlarmChanged":[{"__symbolic":"method"}],"doVariableValuesChanged":[{"__symbolic":"method"}],"doVirtualDeviceStatesChanged":[{"__symbolic":"method"}],"doVariableStatesChanged":[{"__symbolic":"method"}],"subscribeVariableStates":[{"__symbolic":"method"}],"subscribeVariableState":[{"__symbolic":"method"}],"requestVirtualDeviceState":[{"__symbolic":"method"}],"openVariables":[{"__symbolic":"method"}],"openVariable":[{"__symbolic":"method"}],"write":[{"__symbolic":"method"}],"writeWordByBit":[{"__symbolic":"method"}],"subscribeUserDeviceAlarms":[{"__symbolic":"method"}],"registerSystemVariableHandler":[{"__symbolic":"method"}],"notifySystemVariableChange":[{"__symbolic":"method"}],"dispose":[{"__symbolic":"method"}]}}}}]
@@ -4,10 +4,15 @@ export interface RemoteVariableProtocol {
4
4
  connected: Observable<void>;
5
5
  variableStatesChanged: Observable<VariableValue[]>;
6
6
  variableValuesChanged: Observable<VariableValue[]>;
7
+ virtualDeviceAlarmsChanged: Observable<any>;
7
8
  tryOpenVariables(variableNames: string[], appId: string): Observable<void>;
8
9
  tryStopVariables(variableNames: string[], appId: string): Observable<void>;
9
10
  writeVariable(variableName: string, value: any): Observable<void>;
10
11
  writeVariableWordByBit(variableName: string, index: number, value: number): Observable<void>;
12
+ requestVirtualDeviceState(): Observable<void>;
13
+ virtualDeviceStatesChanged: Observable<any>;
11
14
  subscribeVariableStates(variableNames: string[]): Observable<void>;
12
15
  unsubscribeVariableStates(variableNames: string[]): Observable<void>;
16
+ subscribeVirtualDeviceAlarms(appId: string): any;
17
+ unsubscribeVirtualDeviceAlarms(appId: string): any;
13
18
  }
@@ -1,4 +1,8 @@
1
1
  export { WeatherService } from './weather.service';
2
2
  export { PermissionChecker } from './permission-checker';
3
+ export { ReleasedVariableService } from './released-variable';
3
4
  export * from './operation-record';
4
5
  export * from './video';
6
+ export * from './text-library.service';
7
+ export * from './language.service';
8
+ export * from './system-text-library.service';
package/service/index.js CHANGED
@@ -0,0 +1 @@
1
+ export * from './system-text-library.service';
@@ -1 +1 @@
1
- [{"__symbolic":"module","version":4,"metadata":{},"exports":[{"from":"./weather.service","export":["WeatherService"]},{"from":"./permission-checker","export":["PermissionChecker"]},{"from":"./operation-record"},{"from":"./video"}]}]
1
+ [{"__symbolic":"module","version":4,"metadata":{},"exports":[{"from":"./weather.service","export":["WeatherService"]},{"from":"./permission-checker","export":["PermissionChecker"]},{"from":"./released-variable","export":["ReleasedVariableService"]},{"from":"./operation-record"},{"from":"./video"},{"from":"./text-library.service"},{"from":"./language.service"},{"from":"./system-text-library.service"}]}]
@@ -0,0 +1,37 @@
1
+ import { Observable } from 'rxjs';
2
+ /**
3
+ * 语种 DTO 接口 - 与 Designer 中的 API 返回格式保持一致
4
+ */
5
+ export interface ConfigureLanguageDto {
6
+ name: string;
7
+ displayName: string;
8
+ icon: string;
9
+ isDefault: boolean;
10
+ isSystem: boolean;
11
+ }
12
+ /**
13
+ * 语种服务接口
14
+ * 提供语种的查询能力,供 GUI 组件使用
15
+ */
16
+ export interface LanguageService {
17
+ /**
18
+ * 获取所有语种
19
+ */
20
+ getLanguages(): ConfigureLanguageDto[];
21
+ /**
22
+ * 获取默认语言代码
23
+ */
24
+ getDefaultLanguage(): string;
25
+ /**
26
+ * 根据语种代码获取语种信息
27
+ */
28
+ getLanguageByCode(code: string): ConfigureLanguageDto | null;
29
+ /**
30
+ * 检查是否有缓存数据
31
+ */
32
+ hasCache(): boolean;
33
+ /**
34
+ * 缓存更新事件 (可选)
35
+ */
36
+ readonly cacheUpdated?: Observable<void>;
37
+ }
File without changes
@@ -0,0 +1 @@
1
+ [{"__symbolic":"module","version":4,"metadata":{"ConfigureLanguageDto":{"__symbolic":"interface"},"LanguageService":{"__symbolic":"interface"}}}]
@@ -0,0 +1 @@
1
+ export { ReleasedVariableService } from './released-variable.service';
File without changes
@@ -0,0 +1 @@
1
+ [{"__symbolic":"module","version":4,"metadata":{},"exports":[{"from":"./released-variable.service","export":["ReleasedVariableService"]}]}]
@@ -0,0 +1,4 @@
1
+ import { Observable } from 'rxjs';
2
+ export interface ReleasedVariableService {
3
+ getVariableWithValueTransform(variableName: any): Observable<any>;
4
+ }
@@ -0,0 +1 @@
1
+ [{"__symbolic":"module","version":4,"metadata":{"ReleasedVariableService":{"__symbolic":"interface"}}}]
@@ -0,0 +1,76 @@
1
+ import { Observable } from 'rxjs';
2
+ /**
3
+ * 系统文本条目接口
4
+ */
5
+ export interface SystemTextEntry {
6
+ key: string;
7
+ value: string;
8
+ referenceLocation: string;
9
+ isKeyReadOnly: boolean;
10
+ cultures: {
11
+ [key: string]: string;
12
+ };
13
+ }
14
+ /**
15
+ * 系统文本库缓存数据接口
16
+ */
17
+ export interface SystemTextLibraryCacheData {
18
+ id: number;
19
+ name: string;
20
+ systemType: string;
21
+ data: SystemTextEntry[];
22
+ }
23
+ /**
24
+ * 系统文本库类型常量
25
+ */
26
+ export declare const SYSTEM_TEXT_LIBRARY_TYPES: {
27
+ COMPONENT_BUILTIN: string;
28
+ };
29
+ /**
30
+ * 告警表表头 key 常量
31
+ */
32
+ export declare const ALARM_TABLE_HEADER_KEYS: {
33
+ ALARM_NAME: string;
34
+ ALARM_MESSAGE: string;
35
+ ALARM_LEVEL: string;
36
+ TIME: string;
37
+ };
38
+ /**
39
+ * 时间段 key 常量(用于告警表和历史曲线下拉选择)
40
+ * 对应 localization 中的: lastThirtyMinutes, lastOneHour, lastEightHour, lastTwentyFourHours, lastSevenDays, lastThirtyDays, lastOneYear
41
+ */
42
+ export declare const TIME_PERIOD_KEYS: {
43
+ LAST_THIRTY_MINUTES: string;
44
+ LAST_ONE_HOUR: string;
45
+ LAST_EIGHT_HOURS: string;
46
+ LAST_TWENTY_FOUR_HOURS: string;
47
+ LAST_SEVEN_DAYS: string;
48
+ LAST_THIRTY_DAYS: string;
49
+ LAST_ONE_YEAR: string;
50
+ };
51
+ /**
52
+ * 系统文本库服务接口
53
+ * 提供系统文本库的查询能力,供 GUI 组件使用
54
+ */
55
+ export interface SystemTextLibraryService {
56
+ /**
57
+ * 根据 systemType 获取系统文本库
58
+ */
59
+ getSystemTextLibrary(systemType: string): SystemTextLibraryCacheData | null;
60
+ /**
61
+ * 根据 systemType 和 key 获取系统文本条目
62
+ */
63
+ getSystemTextEntry(systemType: string, entryKey: string): SystemTextEntry | null;
64
+ /**
65
+ * 根据 systemType、key 和语言获取系统文本值
66
+ */
67
+ getSystemTextValue(systemType: string, entryKey: string, culture?: string): string | null;
68
+ /**
69
+ * 检查系统文本库缓存是否存在
70
+ */
71
+ hasSystemTextLibraryCache(systemType: string): boolean;
72
+ /**
73
+ * 缓存更新事件 (可选)
74
+ */
75
+ readonly cacheUpdated?: Observable<void>;
76
+ }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * 系统文本库类型常量
3
+ */
4
+ export const SYSTEM_TEXT_LIBRARY_TYPES = {
5
+ COMPONENT_BUILTIN: 'ComponentBuiltIn'
6
+ };
7
+ /**
8
+ * 告警表表头 key 常量
9
+ */
10
+ export const ALARM_TABLE_HEADER_KEYS = {
11
+ ALARM_NAME: 'AlarmTable.Header.AlarmName',
12
+ ALARM_MESSAGE: 'AlarmTable.Header.AlarmMessage',
13
+ ALARM_LEVEL: 'AlarmTable.Header.AlarmLevel',
14
+ TIME: 'AlarmTable.Header.Time'
15
+ };
16
+ /**
17
+ * 时间段 key 常量(用于告警表和历史曲线下拉选择)
18
+ * 对应 localization 中的: lastThirtyMinutes, lastOneHour, lastEightHour, lastTwentyFourHours, lastSevenDays, lastThirtyDays, lastOneYear
19
+ */
20
+ export const TIME_PERIOD_KEYS = {
21
+ LAST_THIRTY_MINUTES: 'HistoricalCurve.TimeFilter.Last30Minutes',
22
+ LAST_ONE_HOUR: 'HistoricalCurve.TimeFilter.Last1Hour',
23
+ LAST_EIGHT_HOURS: 'HistoricalCurve.TimeFilter.Last8Hours',
24
+ LAST_TWENTY_FOUR_HOURS: 'HistoricalCurve.TimeFilter.Last24Hours',
25
+ LAST_SEVEN_DAYS: 'HistoricalCurve.TimeFilter.Last7Days',
26
+ LAST_THIRTY_DAYS: 'HistoricalCurve.TimeFilter.Last30Days',
27
+ LAST_ONE_YEAR: 'HistoricalCurve.TimeFilter.Last1Year'
28
+ };
@@ -0,0 +1 @@
1
+ [{"__symbolic":"module","version":4,"metadata":{"SystemTextEntry":{"__symbolic":"interface"},"SystemTextLibraryCacheData":{"__symbolic":"interface"},"SYSTEM_TEXT_LIBRARY_TYPES":{"COMPONENT_BUILTIN":"ComponentBuiltIn"},"ALARM_TABLE_HEADER_KEYS":{"ALARM_NAME":"AlarmTable.Header.AlarmName","ALARM_MESSAGE":"AlarmTable.Header.AlarmMessage","ALARM_LEVEL":"AlarmTable.Header.AlarmLevel","TIME":"AlarmTable.Header.Time"},"TIME_PERIOD_KEYS":{"LAST_THIRTY_MINUTES":"HistoricalCurve.TimeFilter.Last30Minutes","LAST_ONE_HOUR":"HistoricalCurve.TimeFilter.Last1Hour","LAST_EIGHT_HOURS":"HistoricalCurve.TimeFilter.Last8Hours","LAST_TWENTY_FOUR_HOURS":"HistoricalCurve.TimeFilter.Last24Hours","LAST_SEVEN_DAYS":"HistoricalCurve.TimeFilter.Last7Days","LAST_THIRTY_DAYS":"HistoricalCurve.TimeFilter.Last30Days","LAST_ONE_YEAR":"HistoricalCurve.TimeFilter.Last1Year"},"SystemTextLibraryService":{"__symbolic":"interface"}}}]
@@ -0,0 +1,49 @@
1
+ import { Observable } from 'rxjs';
2
+ /**
3
+ * 文本条目接口
4
+ */
5
+ export interface TextEntry {
6
+ key: string;
7
+ value: string;
8
+ cultures: {
9
+ [key: string]: string;
10
+ };
11
+ }
12
+ /**
13
+ * 文本库缓存数据接口
14
+ */
15
+ export interface TextLibraryCacheData {
16
+ id: number;
17
+ name: string;
18
+ data: TextEntry[];
19
+ }
20
+ /**
21
+ * 文本库服务接口
22
+ * 提供文本库的查询能力,供 GUI 组件使用
23
+ */
24
+ export interface TextLibraryService {
25
+ /**
26
+ * 获取所有文本库
27
+ */
28
+ getAllTextLibraries(): TextLibraryCacheData[];
29
+ /**
30
+ * 根据ID获取文本库
31
+ */
32
+ getTextLibraryById(id: number): TextLibraryCacheData | null;
33
+ /**
34
+ * 根据文本库ID和条目key获取文本条目
35
+ */
36
+ getTextEntry(textLibraryId: number, entryKey: string): TextEntry | null;
37
+ /**
38
+ * 根据文本库ID、条目key和语言获取文本值
39
+ */
40
+ getTextValue(textLibraryId: number, entryKey: string, culture?: string): string | null;
41
+ /**
42
+ * 检查是否有缓存数据
43
+ */
44
+ hasCache(): boolean;
45
+ /**
46
+ * 缓存更新事件 (可选)
47
+ */
48
+ readonly cacheUpdated?: Observable<void>;
49
+ }
File without changes
@@ -0,0 +1 @@
1
+ [{"__symbolic":"module","version":4,"metadata":{"TextEntry":{"__symbolic":"interface"},"TextLibraryCacheData":{"__symbolic":"interface"},"TextLibraryService":{"__symbolic":"interface"}}}]
@@ -1,3 +1,4 @@
1
1
  export interface WeatherService {
2
2
  getWeatherInfo(): Promise<any>;
3
+ getAirQualityInfo(): Promise<any>;
3
4
  }
@@ -26,5 +26,8 @@ export declare class GuiConsts {
26
26
  videokey: string;
27
27
  tableKey: string;
28
28
  weatherKey: string;
29
+ airQualityKey: string;
30
+ alarmKey: string;
31
+ scrollAlarmKey: string;
29
32
  };
30
33
  }
@@ -27,4 +27,7 @@ GuiConsts.components = {
27
27
  videokey: 'Video',
28
28
  tableKey: 'Table',
29
29
  weatherKey: 'Weather',
30
+ airQualityKey: 'AirQualityIndex',
31
+ alarmKey: 'Alarm',
32
+ scrollAlarmKey: 'ScrollAlarm'
30
33
  };
@@ -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"}}}}}]
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","scrollAlarmKey":"ScrollAlarm"}}}}}]