@flexem/fc-gui 3.0.0-alpha.131 → 3.0.0-alpha.133

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.
@@ -42245,8 +42245,8 @@ class scroll_alarm_element_ScrollAlarmElement extends conditional_dynamic_displa
42245
42245
  this.variableCommunicator = variableCommunicator;
42246
42246
  this.autoCycle = (_b = (_a = this.model.generalSetting) === null || _a === void 0 ? void 0 : _a.autoCycle) !== null && _b !== void 0 ? _b : true;
42247
42247
  this.maxResultCount = (_d = (_c = this.model.generalSetting) === null || _c === void 0 ? void 0 : _c.pageSize) !== null && _d !== void 0 ? _d : 500;
42248
- // 检测是否是模拟运行模式(通过检查 alarmsStore 的类型)
42249
- this.isSimulateMode = alarmsStore && alarmsStore.constructor.name === 'SimulateAlarmDataStore';
42248
+ // 检测是否是模拟运行模式(通过检查 alarmsStore 的标记属性,不受代码混淆影响)
42249
+ this.isSimulateMode = alarmsStore && alarmsStore.isSimulationStore === true;
42250
42250
  if (this.model.filterSetting && this.model.filterSetting.detailsData && this.model.filterSetting.detailsData.length > 0) {
42251
42251
  this.alarmNames = this.model.filterSetting.detailsData.map(item => item.name);
42252
42252
  // 如果是模拟运行模式,使用静态显示逻辑(类似设计态)
@@ -42494,7 +42494,6 @@ class scroll_alarm_element_ScrollAlarmElement extends conditional_dynamic_displa
42494
42494
  this.allAlarmsContainer = document.createElement('div');
42495
42495
  this.allAlarmsContainer.style.cssText = `
42496
42496
  position: absolute;
42497
- left: ${elementWidth}px;
42498
42497
  top: 50%;
42499
42498
  transform: translateY(-50%);
42500
42499
  display: flex;
@@ -42504,6 +42503,7 @@ class scroll_alarm_element_ScrollAlarmElement extends conditional_dynamic_displa
42504
42503
  this.container.appendChild(this.allAlarmsContainer);
42505
42504
  // 设置初始位置为容器宽度,让内容从右侧滚入
42506
42505
  this.currentLeft = elementWidth;
42506
+ this.allAlarmsContainer.style.left = `${elementWidth}px`;
42507
42507
  // 添加鼠标悬停暂停和恢复滚动功能
42508
42508
  this.container.addEventListener('mouseenter', () => this.pauseScroll());
42509
42509
  this.container.addEventListener('mouseleave', () => this.resumeScroll());
@@ -42812,27 +42812,28 @@ class scroll_alarm_element_ScrollAlarmElement extends conditional_dynamic_displa
42812
42812
  }
42813
42813
  // 设置文本内容
42814
42814
  textContainer.textContent = textParts.join(' ');
42815
- this.allAlarmsContainer.appendChild(textContainer);
42816
- // 计算文本宽度
42817
- const textWidth = textContainer.offsetWidth;
42818
- this.totalWidth = textWidth;
42819
- this.pageWidths.push(textWidth);
42820
- // 设置初始位置为容器宽度(从右侧滚入)
42821
- this.currentLeft = this.container.clientWidth;
42815
+ // 使用配置的宽度,而不是 clientWidth(因为DOM可能还没渲染完成)
42816
+ const containerWidth = this.model.size.width;
42817
+ // 先设置容器位置到右侧(屏幕外),这样添加元素时不会闪烁
42818
+ this.currentLeft = containerWidth;
42822
42819
  this.allAlarmsContainer.style.left = `${this.currentLeft}px`;
42823
- // 根据 autoCycle 配置决定是否启动滚动
42824
- if (this.autoCycle) {
42820
+ // 添加到DOM以便计算宽度
42821
+ this.allAlarmsContainer.appendChild(textContainer);
42822
+ // 使用 setTimeout 确保 DOM 渲染完成后再计算宽度
42823
+ setTimeout(() => {
42824
+ // 计算文本宽度
42825
+ const textWidth = textContainer.offsetWidth;
42826
+ this.totalWidth = textWidth;
42827
+ this.pageWidths.push(textWidth);
42828
+ // 启动滚动(autoCycle 只控制是否循环,不控制是否滚动)
42825
42829
  this.initStaticScrolling();
42826
- }
42830
+ }, 50);
42827
42831
  }
42828
42832
  /**
42829
42833
  * 模拟运行时的静态滚动逻辑
42830
42834
  */
42831
42835
  initStaticScrolling() {
42832
42836
  clearInterval(this.scrollIntervalId);
42833
- // 确保初始位置在容器右侧
42834
- this.currentLeft = this.container.clientWidth;
42835
- this.allAlarmsContainer.style.left = `${this.currentLeft}px`;
42836
42837
  const scrollInterval = 100;
42837
42838
  // 延迟启动滚动确保内容渲染完成
42838
42839
  setTimeout(() => {
@@ -42852,11 +42853,17 @@ class scroll_alarm_element_ScrollAlarmElement extends conditional_dynamic_displa
42852
42853
  const scrollStep = 2;
42853
42854
  // 更新位置 - 从右往左滚动
42854
42855
  this.currentLeft -= scrollStep;
42855
- // 当内容完全滚出容器左侧时
42856
- if (this.currentLeft + this.totalWidth < 0) {
42856
+ // 更新显示位置
42857
+ this.allAlarmsContainer.style.left = `${this.currentLeft}px`;
42858
+ // 当内容完全滚出容器左侧时(内容右边缘完全移出容器左边缘)
42859
+ // currentLeft + totalWidth 表示内容右边缘的位置
42860
+ // 当这个值 <= 0 时,表示内容右边缘已经到达或超过容器左边缘,内容完全不可见
42861
+ const rightEdge = this.currentLeft + this.totalWidth;
42862
+ if (rightEdge <= 0) {
42857
42863
  if (this.autoCycle) {
42858
- // 自动循环模式:重置到容器右侧
42859
- this.currentLeft = this.container.clientWidth;
42864
+ // 自动循环模式:重置到容器右侧(使用配置宽度)
42865
+ this.currentLeft = this.model.size.width;
42866
+ this.allAlarmsContainer.style.left = `${this.currentLeft}px`;
42860
42867
  }
42861
42868
  else {
42862
42869
  // 非循环模式:停止滚动
@@ -42865,8 +42872,6 @@ class scroll_alarm_element_ScrollAlarmElement extends conditional_dynamic_displa
42865
42872
  return;
42866
42873
  }
42867
42874
  }
42868
- // 更新显示位置
42869
- this.allAlarmsContainer.style.left = `${this.currentLeft}px`;
42870
42875
  }
42871
42876
  }
42872
42877