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

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.
@@ -205,7 +205,9 @@ export class SwitchIndicatorLightElement extends ConditionalEnableElement {
205
205
  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);
206
206
  if (validNames && !validNames.includes(convertedName)) {
207
207
  this.updateElementStates([new VariableState(convertedName, VariableStateEnum.InvalidMonitor)]);
208
- return;
208
+ // 无效变量时先显示第一个状态样式,避免空白;
209
+ // 但仍继续初始化订阅,以便后续收到 Offline/Unbind 时能正确覆盖
210
+ this.switchToState(0);
209
211
  }
210
212
  }
211
213
  switch (settings.type) {
@@ -236,6 +238,10 @@ export class SwitchIndicatorLightElement extends ConditionalEnableElement {
236
238
  else if (!isUndefined(statusIdValue.value)) {
237
239
  this.switchToState(statusIdValue.value);
238
240
  }
241
+ else {
242
+ // 变量值为 null/undefined(含无效变量)时,显示第一个状态样式
243
+ this.switchToState(0);
244
+ }
239
245
  }
240
246
  switchToState(stateId) {
241
247
  this.textStateElement.switchToState(stateId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "main": "bundles/fc-gui.umd.js",
3
- "version": "3.0.0-alpha.164",
3
+ "version": "3.0.0-alpha.166",
4
4
  "module": "public_api.js",
5
5
  "typings": "public_api.d.ts",
6
6
  "license": "UNLICENSED",