@flexem/fc-gui 3.0.0-alpha.154 → 3.0.0-alpha.156

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.
@@ -44291,11 +44291,11 @@ let WriteValueModalComponent = class WriteValueModalComponent {
44291
44291
  this.validate();
44292
44292
  }
44293
44293
  initData(option) {
44294
- var _a, _b, _c;
44294
+ var _a, _b, _c, _d, _e;
44295
44295
  this.variableName = option.variableName;
44296
44296
  this.displayVariableName = this.variableName;
44297
44297
  if (this.variableName === '当前语种ID') {
44298
- const language = (_c = (_b = (_a = window.abp) === null || _a === void 0 ? void 0 : _a.localization) === null || _b === void 0 ? void 0 : _b.currentLanguage) === null || _c === void 0 ? void 0 : _c.name;
44298
+ const language = ((_c = (_b = (_a = window.abp) === null || _a === void 0 ? void 0 : _a.localization) === null || _b === void 0 ? void 0 : _b.currentLanguage) === null || _c === void 0 ? void 0 : _c.name) || ((_e = (_d = this.localization.localizationService) === null || _d === void 0 ? void 0 : _d.translate) === null || _e === void 0 ? void 0 : _e.currentLang);
44299
44299
  const isTraditionalChinese = language === 'zh-Hant' || language === 'zh-TW' || language === 'zh-tw';
44300
44300
  const isChinese = language === 'zh-Hans' || language === 'zh';
44301
44301
  if (isTraditionalChinese) {
@@ -66091,10 +66091,18 @@ class remote_variable_communicator_RemoteVariableCommunicator {
66091
66091
  ob.next([state]);
66092
66092
  });
66093
66093
  }
66094
- // 离线时从预加载缓存取值推送给值订阅者
66095
- if (_tmp_config["j" /* GuiFeatureConfig */].isOfflineDisplayEnabled && state.state === communication["d" /* VariableStateEnum */].Offline && this.offlineValueCache.has(variableName)) {
66096
- const cachedValue = this.offlineValueCache.get(variableName);
66097
- if (cachedValue !== null) {
66094
+ // 离线时推送最后已知值给值订阅者
66095
+ if (_tmp_config["j" /* GuiFeatureConfig */].isOfflineDisplayEnabled && state.state === communication["d" /* VariableStateEnum */].Offline) {
66096
+ let cachedValue;
66097
+ // 优先用最后一次收到的值(可能是在线时推送的),覆盖所有切页/重连场景
66098
+ if (this.variableValueCache.has(variableName)) {
66099
+ cachedValue = this.variableValueCache.get(variableName).value;
66100
+ }
66101
+ else if (this.offlineValueCache.has(variableName)) {
66102
+ // 兜底:变量从未收到过值,用预加载的离线值
66103
+ cachedValue = this.offlineValueCache.get(variableName);
66104
+ }
66105
+ if (cachedValue !== null && cachedValue !== undefined) {
66098
66106
  const variableValue = {
66099
66107
  variableName,
66100
66108
  value: cachedValue,
@@ -66108,8 +66116,6 @@ class remote_variable_communicator_RemoteVariableCommunicator {
66108
66116
  }
66109
66117
  }
66110
66118
  }
66111
- // 无论什么状态,推送后清除缓存,防止后续再次离线时用旧值
66112
- this.offlineValueCache.delete(variableName);
66113
66119
  });
66114
66120
  });
66115
66121
  }