@flexem/fc-gui 3.0.0-alpha.139 → 3.0.0-alpha.140

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.
@@ -37211,36 +37211,38 @@ class historical_curve_element_HistoricalCurveElement extends conditional_displa
37211
37211
  * 更新语种相关的文案(时间段选择器)
37212
37212
  */
37213
37213
  updateLanguageTexts() {
37214
- const selectElement = this.rootElement.select('select');
37215
- if (!selectElement.empty()) {
37216
- // 重新生成时间段数据
37217
- const updatedTimePeriods = this.getValidTimePeriods();
37218
- this.timePeriods = updatedTimePeriods;
37219
- // 更新选项文本
37220
- const options = selectElement.selectAll('option');
37221
- options.each(function (_d, i) {
37214
+ // 重新生成时间段数据
37215
+ const updatedTimePeriods = this.getValidTimePeriods();
37216
+ this.timePeriods = updatedTimePeriods;
37217
+ // select foreignObject 内部的 HTML 命名空间中,D3 的 rootElement.select('select') 无法跨命名空间查找
37218
+ // 改用 jQuery 查找
37219
+ const nativeSelectEl = this.$element && this.$element.find('select');
37220
+ if (nativeSelectEl && nativeSelectEl.length > 0) {
37221
+ const options = nativeSelectEl.find('option');
37222
+ options.each(function (i) {
37222
37223
  if (i < updatedTimePeriods.length) {
37223
- d3["select"](this).text(updatedTimePeriods[i].name);
37224
+ this.text = updatedTimePeriods[i].name;
37224
37225
  }
37225
37226
  });
37226
37227
  }
37228
+ // 如果 select 元素不存在,timePeriods 已更新,下次 renderOperationArea 时会使用新的文本
37227
37229
  }
37228
37230
  /**
37229
37231
  * 获取当前语种的 culture 代码
37230
37232
  */
37231
37233
  getCurrentCulture() {
37232
- var _a, _b, _c, _e, _f, _g;
37234
+ var _a, _b, _c, _d, _e, _f;
37233
37235
  // 获取当前语种ID
37234
37236
  const currentLanguageId = (_c = (_b = (_a = this.guiContext) === null || _a === void 0 ? void 0 : _a.getCurrentLanguageId) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : null;
37235
37237
  // 确定要使用的语种代码(culture)
37236
- const defaultLanguage = ((_e = this.languageService) === null || _e === void 0 ? void 0 : _e.getDefaultLanguage()) || 'zh-CN';
37238
+ const defaultLanguage = ((_d = this.languageService) === null || _d === void 0 ? void 0 : _d.getDefaultLanguage()) || 'zh-CN';
37237
37239
  if (currentLanguageId === null || currentLanguageId === undefined) {
37238
37240
  // 设备未设置当前语种,使用默认语种
37239
37241
  return defaultLanguage;
37240
37242
  }
37241
37243
  else {
37242
37244
  // 设备已设置当前语种,获取对应的语种代码
37243
- const currentLanguage = (_g = (_f = this.guiContext) === null || _f === void 0 ? void 0 : _f.getLanguageCultureById) === null || _g === void 0 ? void 0 : _g.call(_f, currentLanguageId);
37245
+ const currentLanguage = (_f = (_e = this.guiContext) === null || _e === void 0 ? void 0 : _e.getLanguageCultureById) === null || _f === void 0 ? void 0 : _f.call(_e, currentLanguageId);
37244
37246
  if (currentLanguage) {
37245
37247
  return currentLanguage;
37246
37248
  }