@flexem/fc-gui 3.0.0-alpha.169 → 3.0.0-alpha.170

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.
@@ -195,19 +195,20 @@ export class SwitchIndicatorLightElement extends ConditionalEnableElement {
195
195
  }
196
196
  }
197
197
  initIndictorLightOperator() {
198
- var _a, _b, _c, _d;
198
+ var _a, _b, _c, _d, _e, _f;
199
199
  const settings = this.model.indicatorLightSettings;
200
200
  if (settings.settings.variableName) {
201
201
  const variable = new VariableDefinition(settings.settings.variableName, settings.settings.variableGroupName, settings.settings.dataSourceCode, settings.settings.variableVersion);
202
202
  const convertedName = VariableUtil.getConvertedVariableName(this.variableStore, variable);
203
203
  this.addElementState(new VariableState(convertedName, undefined));
204
204
  this.initState();
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);
205
+ // 模拟模式下优先用后端 GetVariablesForDesigner 查出的有效变量(绑定了 manager)
206
+ // 运行模式不填充 validVariableNames,回退到 variableStore.getAllVariableNames()
207
+ const validNames = (_b = (_a = this.guiContext) === null || _a === void 0 ? void 0 : _a.validVariableNames) !== null && _b !== void 0 ? _b : (_f = (_e = (_d = (_c = this.guiContext) === null || _c === void 0 ? void 0 : _c.configStore) === null || _d === void 0 ? void 0 : _d.variableStore) === null || _e === void 0 ? void 0 : _e.getAllVariableNames) === null || _f === void 0 ? void 0 : _f.call(_e);
206
208
  if (validNames && !validNames.includes(convertedName)) {
207
209
  this.updateElementStates([new VariableState(convertedName, VariableStateEnum.InvalidMonitor)]);
208
- // 无效变量时先显示第一个状态样式,避免空白;
209
- // 但仍继续初始化订阅,以便后续收到 Offline/Unbind 时能正确覆盖
210
210
  this.switchToState(0);
211
+ return;
211
212
  }
212
213
  }
213
214
  switch (settings.type) {
@@ -17,6 +17,12 @@ export interface GuiContext {
17
17
  readonly systemTextLibraryService?: SystemTextLibraryService;
18
18
  readonly configureViewId?: number;
19
19
  readonly configureViewCode?: string;
20
+ /**
21
+ * 模拟模式下由后端 GetVariablesForDesigner 查询出的"有效变量"名集合
22
+ * (IncludeCalculationVariable=true, HasRefVariable=true,即绑定了 manager 的变量)。
23
+ * 运行模式不填充,元件会回退到 variableStore.getAllVariableNames()。
24
+ */
25
+ readonly validVariableNames?: string[];
20
26
  readonly languageChanged$?: Subject<number | null>;
21
27
  getCurrentLanguageId?(): number | null;
22
28
  getDefaultLanguageId?(): number;
package/gui/gui-view.js CHANGED
@@ -64,7 +64,7 @@ export class GuiView {
64
64
  this.logger.debug('[GUI] View loaded.');
65
65
  }
66
66
  loadElementState() {
67
- var _a, _b;
67
+ var _a, _b, _c;
68
68
  if (!this.mainElement) {
69
69
  return;
70
70
  }
@@ -109,7 +109,7 @@ export class GuiView {
109
109
  });
110
110
  normalVariablesForState.splice(normalVariablesForState.indexOf('设备状态'), 1);
111
111
  }
112
- const validVariableNames = (_b = (_a = this.context.configStore.variableStore).getAllVariableNames) === null || _b === void 0 ? void 0 : _b.call(_a);
112
+ const validVariableNames = (_a = this.context.validVariableNames) !== null && _a !== void 0 ? _a : (_c = (_b = this.context.configStore.variableStore).getAllVariableNames) === null || _c === void 0 ? void 0 : _c.call(_b);
113
113
  if (validVariableNames) {
114
114
  const invalidVariables = normalVariablesForState.filter(name => !validVariableNames.includes(name));
115
115
  if (invalidVariables.length > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "main": "bundles/fc-gui.umd.js",
3
- "version": "3.0.0-alpha.169",
3
+ "version": "3.0.0-alpha.170",
4
4
  "module": "public_api.js",
5
5
  "typings": "public_api.d.ts",
6
6
  "license": "UNLICENSED",