@flexem/fc-gui 3.0.0-alpha.114 → 3.0.0-alpha.115

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.
@@ -21868,11 +21868,13 @@ var variable_communicator = __webpack_require__(262);
21868
21868
 
21869
21869
  // CONCATENATED MODULE: ./.tmp/communication/variable/variable-value.ts
21870
21870
  class VariableValue {
21871
- constructor(variableName, state, value, timeStamp) {
21871
+ constructor(variableName, state, value, timeStamp, systemName, customStatus) {
21872
21872
  this.variableName = variableName;
21873
21873
  this.state = state;
21874
21874
  this.value = value;
21875
21875
  this.timeStamp = timeStamp;
21876
+ this.systemName = systemName;
21877
+ this.customStatus = customStatus;
21876
21878
  }
21877
21879
  }
21878
21880
 
@@ -35094,6 +35096,9 @@ class state_control_element_StateControlElement extends conditional_dynamic_disp
35094
35096
  if (!this.currentRect.length) {
35095
35097
  return;
35096
35098
  }
35099
+ // 元件绑定设备状态时不需要在右上角显示状态
35100
+ if (this.$element[0].dataset.model.includes('设备状态'))
35101
+ return;
35097
35102
  const document = this.$element[0].ownerDocument;
35098
35103
  const imgObj = document.createElementNS('http://www.w3.org/2000/svg', 'image');
35099
35104
  if (imgObj) {
@@ -35312,7 +35317,7 @@ class readable_element_ReadableElement extends conditional_enable_element_Condit
35312
35317
  }
35313
35318
  reportValueChanged(value) {
35314
35319
  Object(lodash["forEach"])(this.elementStates, elementState => {
35315
- if (elementState.variableName === value.variableName) {
35320
+ if (elementState.variableName === value.variableName || elementState.variableName === value.systemName) {
35316
35321
  elementState.state = value.state;
35317
35322
  this.changeStates();
35318
35323
  }
@@ -35322,6 +35327,9 @@ class readable_element_ReadableElement extends conditional_enable_element_Condit
35322
35327
  || value.variableName === this.maxVariableName) {
35323
35328
  this.updateVariableValue(value.value, value.variableName);
35324
35329
  }
35330
+ if (value.systemName === '设备状态') {
35331
+ this.updateVariableValue(value.customStatus, '设备状态');
35332
+ }
35325
35333
  }
35326
35334
  }
35327
35335
 
@@ -41588,7 +41596,8 @@ class main_element_MainElement {
41588
41596
  Object(lodash["each"])(values, value => {
41589
41597
  Object(lodash["each"])(this.elements, e => {
41590
41598
  if (e instanceof readable_element_ReadableElement) {
41591
- if (e.readVariableName === value.variableName || e.minVariableName === value.variableName || e.maxVariableName === value.variableName) {
41599
+ if ((value.variableName && (e.readVariableName === value.variableName ||
41600
+ e.minVariableName === value.variableName || e.maxVariableName === value.variableName)) || e.readVariableName === value.systemName) {
41592
41601
  e.reportValueChanged(value);
41593
41602
  }
41594
41603
  }
@@ -41689,6 +41698,9 @@ class per_view_variable_communicator_PerViewVariableCommunicator {
41689
41698
  writeWordByBit(variableName, index, value) {
41690
41699
  return this._rawVariableCommunicator.writeWordByBit(variableName, index, value);
41691
41700
  }
41701
+ requestVirtualDeviceState() {
41702
+ return this._rawVariableCommunicator.requestVirtualDeviceState();
41703
+ }
41692
41704
  subscribeVariableState(variableName) {
41693
41705
  return this.subscribeVariableStates([variableName]).pipe(Object(operators_["map"])(values => values[0]));
41694
41706
  }
@@ -41787,22 +41799,57 @@ class gui_view_GuiView {
41787
41799
  this.openVariableStatesSubscription.unsubscribe();
41788
41800
  }
41789
41801
  this.openedVariableNames = this.mainElement.getVariableNames();
41790
- if (this.openedVariableNames.length === 0) {
41791
- return;
41802
+ if (this.openedVariableNames.indexOf('设备状态') !== -1) {
41803
+ if (this.requestVirtualDeviceState) {
41804
+ this.requestVirtualDeviceState.unsubscribe();
41805
+ }
41806
+ if (this.requestVirtualDeviceState) {
41807
+ this.requestVirtualDeviceState.unsubscribe();
41808
+ }
41809
+ if (this.openedVariableNames.length === 1) {
41810
+ this.normalOpenedVariableNames(['设备状态']);
41811
+ this.requestVirtualDeviceState =
41812
+ this.perViewVariableCommunicator.requestVirtualDeviceState().subscribe({
41813
+ complete: () => { }
41814
+ });
41815
+ }
41816
+ else {
41817
+ this.openVariableStatesSubscription =
41818
+ this.perViewVariableCommunicator.subscribeVariableStates(this.openedVariableNames).subscribe((states) => {
41819
+ this.mainElement.reportVariableStates(states);
41820
+ const normalVariableNames = [];
41821
+ Object(lodash["each"])(states, v => {
41822
+ if (v.state === communication["d" /* VariableStateEnum */].Normal && normalVariableNames.indexOf(v.variableName) === -1) {
41823
+ normalVariableNames.push(v.variableName);
41824
+ }
41825
+ });
41826
+ normalVariableNames.push('设备状态');
41827
+ this.normalOpenedVariableNames(normalVariableNames);
41828
+ this.requestVirtualDeviceState =
41829
+ this.perViewVariableCommunicator.requestVirtualDeviceState().subscribe({
41830
+ complete: () => { }
41831
+ });
41832
+ });
41833
+ }
41792
41834
  }
41793
- this.openVariableStatesSubscription =
41794
- this.perViewVariableCommunicator.subscribeVariableStates(this.openedVariableNames).subscribe((states) => {
41795
- this.mainElement.reportVariableStates(states);
41796
- const normalVariableNames = [];
41797
- Object(lodash["each"])(states, v => {
41798
- if (v.state === communication["d" /* VariableStateEnum */].Normal && normalVariableNames.indexOf(v.variableName) === -1) {
41799
- normalVariableNames.push(v.variableName);
41835
+ else {
41836
+ if (this.openedVariableNames.length === 0) {
41837
+ return;
41838
+ }
41839
+ this.openVariableStatesSubscription =
41840
+ this.perViewVariableCommunicator.subscribeVariableStates(this.openedVariableNames).subscribe((states) => {
41841
+ this.mainElement.reportVariableStates(states);
41842
+ const normalVariableNames = [];
41843
+ Object(lodash["each"])(states, v => {
41844
+ if (v.state === communication["d" /* VariableStateEnum */].Normal && normalVariableNames.indexOf(v.variableName) === -1) {
41845
+ normalVariableNames.push(v.variableName);
41846
+ }
41847
+ });
41848
+ if (normalVariableNames.length > 0) {
41849
+ this.normalOpenedVariableNames(normalVariableNames);
41800
41850
  }
41801
41851
  });
41802
- if (normalVariableNames.length > 0) {
41803
- this.normalOpenedVariableNames(normalVariableNames);
41804
- }
41805
- });
41852
+ }
41806
41853
  }
41807
41854
  popView(viewIndex, hostContainerId, el) {
41808
41855
  return this.context.configStore.viewStore.getViewConfig(viewIndex).pipe(Object(operators_["map"])(view => {
@@ -41896,6 +41943,12 @@ class gui_view_GuiView {
41896
41943
  if (this.openVariableStatesSubscription) {
41897
41944
  this.openVariableStatesSubscription.unsubscribe();
41898
41945
  }
41946
+ if (this.requestVirtualDeviceState) {
41947
+ this.requestVirtualDeviceState.unsubscribe();
41948
+ }
41949
+ if (this.virtualDeviceStatesChanged) {
41950
+ this.virtualDeviceStatesChanged.unsubscribe();
41951
+ }
41899
41952
  if (this.openVariablesSubscription) {
41900
41953
  this.openVariablesSubscription.unsubscribe();
41901
41954
  }
@@ -64214,6 +64267,7 @@ class remote_variable_communicator_RemoteVariableCommunicator {
64214
64267
  });
64215
64268
  this.doVariableStatesChanged();
64216
64269
  this.doVariableValuesChanged();
64270
+ this.doVirtualDeviceStatesChanged();
64217
64271
  this.doAlarmChanged();
64218
64272
  }
64219
64273
  doAlarmChanged() {
@@ -64244,6 +64298,25 @@ class remote_variable_communicator_RemoteVariableCommunicator {
64244
64298
  });
64245
64299
  });
64246
64300
  }
64301
+ doVirtualDeviceStatesChanged() {
64302
+ if (this.virtualDeviceStatesChangedSubscription !== undefined) {
64303
+ this.virtualDeviceStatesChangedSubscription.unsubscribe();
64304
+ }
64305
+ this.virtualDeviceStatesChangedSubscription =
64306
+ this.remoteVariableProtocol.virtualDeviceStatesChanged.subscribe((deviceStates) => {
64307
+ Object(lodash["each"])(deviceStates, deviceState => {
64308
+ const variableName = '设备状态';
64309
+ this.variableValueCache.set(variableName, deviceState);
64310
+ const data = Object.assign(Object.assign({}, deviceState), { systemName: '设备状态' });
64311
+ if (this.observers.has(variableName)) {
64312
+ Object(lodash["each"])(this.observers.get(variableName), ob => {
64313
+ // TODO 同一个ob监听多个变量的情况,组合成数组一次推送。
64314
+ ob.next([data]);
64315
+ });
64316
+ }
64317
+ });
64318
+ });
64319
+ }
64247
64320
  doVariableStatesChanged() {
64248
64321
  if (this.variableStatesChangedSubscription !== undefined) {
64249
64322
  this.variableStatesChangedSubscription.unsubscribe();
@@ -64317,6 +64390,9 @@ class remote_variable_communicator_RemoteVariableCommunicator {
64317
64390
  subscribeVariableState(variableName) {
64318
64391
  return this.subscribeVariableStates([variableName]).pipe(Object(operators_["map"])(values => values[0]));
64319
64392
  }
64393
+ requestVirtualDeviceState() {
64394
+ return this.remoteVariableProtocol.requestVirtualDeviceState();
64395
+ }
64320
64396
  openVariables(variableNames, appId = '') {
64321
64397
  return new Observable["a" /* Observable */](observer => {
64322
64398
  let variablesToStart = [];
@@ -64419,6 +64495,7 @@ class remote_variable_communicator_RemoteVariableCommunicator {
64419
64495
  this.connectedSubscription.unsubscribe();
64420
64496
  this.variableStatesChangedSubscription.unsubscribe();
64421
64497
  this.variableValuesChangedSubscription.unsubscribe();
64498
+ this.virtualDeviceStatesChangedSubscription.unsubscribe();
64422
64499
  this.alarmChangedSubscription.unsubscribe();
64423
64500
  if (this.logger && this.logger.isDebugEnabled()) {
64424
64501
  this.logger.debug('[VariableCommunicator] RemoteVariableCommunicator disposed.');