@flexem/fc-gui 3.0.0-alpha.164 → 3.0.0-alpha.165

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.
@@ -35106,19 +35106,22 @@ class state_control_element_StateControlElement extends conditional_dynamic_disp
35106
35106
  }
35107
35107
  changeState(state) {
35108
35108
  switch (state) {
35109
- case _tmp_model["State"].InvalidMonitor:
35110
- this.state = _tmp_model["State"].InvalidMonitor;
35111
- break;
35112
35109
  case _tmp_model["State"].Unbind:
35113
- if (this.state !== _tmp_model["State"].InvalidMonitor) {
35114
- this.state = _tmp_model["State"].Unbind;
35115
- }
35110
+ // Unbind 优先级最高,可覆盖任何状态
35111
+ this.state = _tmp_model["State"].Unbind;
35116
35112
  break;
35117
35113
  case _tmp_model["State"].Offline:
35118
- if (this.state !== _tmp_model["State"].Unbind && this.state !== _tmp_model["State"].InvalidMonitor) {
35114
+ // Offline 优先级次于 Unbind
35115
+ if (this.state !== _tmp_model["State"].Unbind) {
35119
35116
  this.state = _tmp_model["State"].Offline;
35120
35117
  }
35121
35118
  break;
35119
+ case _tmp_model["State"].InvalidMonitor:
35120
+ // InvalidMonitor 优先级低于 Offline/Unbind
35121
+ if (this.state !== _tmp_model["State"].Unbind && this.state !== _tmp_model["State"].Offline) {
35122
+ this.state = _tmp_model["State"].InvalidMonitor;
35123
+ }
35124
+ break;
35122
35125
  case _tmp_model["State"].Loading:
35123
35126
  if (this.state !== _tmp_model["State"].Unbind && this.state !== _tmp_model["State"].Offline && this.state !== _tmp_model["State"].InvalidMonitor) {
35124
35127
  this.state = _tmp_model["State"].Loading;
@@ -40542,7 +40545,9 @@ class switch_indicator_light_element_SwitchIndicatorLightElement extends conditi
40542
40545
  const validNames = (_d = (_c = (_b = (_a = this.guiContext) === null || _a === void 0 ? void 0 : _a.configStore) === null || _b === void 0 ? void 0 : _b.variableStore) === null || _c === void 0 ? void 0 : _c.getAllVariableNames) === null || _d === void 0 ? void 0 : _d.call(_c);
40543
40546
  if (validNames && !validNames.includes(convertedName)) {
40544
40547
  this.updateElementStates([new communication["c" /* VariableState */](convertedName, communication["d" /* VariableStateEnum */].InvalidMonitor)]);
40545
- return;
40548
+ // 无效变量时先显示第一个状态样式,避免空白;
40549
+ // 但仍继续初始化订阅,以便后续收到 Offline/Unbind 时能正确覆盖
40550
+ this.switchToState(0);
40546
40551
  }
40547
40552
  }
40548
40553
  switch (settings.type) {
@@ -40573,6 +40578,10 @@ class switch_indicator_light_element_SwitchIndicatorLightElement extends conditi
40573
40578
  else if (!Object(lodash["isUndefined"])(statusIdValue.value)) {
40574
40579
  this.switchToState(statusIdValue.value);
40575
40580
  }
40581
+ else {
40582
+ // 变量值为 null/undefined(含无效变量)时,显示第一个状态样式
40583
+ this.switchToState(0);
40584
+ }
40576
40585
  }
40577
40586
  switchToState(stateId) {
40578
40587
  this.textStateElement.switchToState(stateId);