@flexem/fc-gui 3.0.0-alpha.134 → 3.0.0-alpha.135

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.
@@ -42600,9 +42600,9 @@ class scroll_alarm_element_ScrollAlarmElement extends conditional_dynamic_displa
42600
42600
  this.getAlarmData();
42601
42601
  }
42602
42602
  }
42603
- // 当内容完全滚出容器左侧时(currentLeft + totalWidth < 0
42604
- // 说明所有内容都已经滚出视图,需要重置或停止
42605
- if (this.currentLeft + this.totalWidth < 0) {
42603
+ // 当内容完全滚出容器左侧时(currentLeft + totalWidth < -50
42604
+ // 说明所有内容都已经滚出视图(不开启自动循环时多滚动50px确保最后一个字完全滚出)
42605
+ if (this.currentLeft + this.totalWidth < -50) {
42606
42606
  if (this.autoCycle) {
42607
42607
  // 自动循环模式:无缝衔接回到容器右侧
42608
42608
  if (this.hasMoreData) {
@@ -42853,9 +42853,9 @@ class scroll_alarm_element_ScrollAlarmElement extends conditional_dynamic_displa
42853
42853
  this.allAlarmsContainer.style.left = `${this.currentLeft}px`;
42854
42854
  // 当内容完全滚出容器左侧时(内容右边缘完全移出容器左边缘)
42855
42855
  // currentLeft + totalWidth 表示内容右边缘的位置
42856
- // 当这个值 <= 0 时,表示内容右边缘已经到达或超过容器左边缘,内容完全不可见
42856
+ // 当这个值 <= -50 时,表示内容完全不可见(不开启自动循环时多滚动50px确保最后一个字完全滚出)
42857
42857
  const rightEdge = this.currentLeft + this.totalWidth;
42858
- if (rightEdge <= 0) {
42858
+ if (rightEdge <= -50) {
42859
42859
  if (this.autoCycle) {
42860
42860
  // 自动循环模式:重置到容器右侧(使用配置宽度)
42861
42861
  this.currentLeft = this.model.size.width;
@@ -42916,17 +42916,24 @@ class scroll_alarm_element_ScrollAlarmElement extends conditional_dynamic_displa
42916
42916
  }
42917
42917
  return;
42918
42918
  }
42919
- // 如果是首次加载或当前没有数据,直接渲染
42919
+ // 如果是首次加载或当前没有数据,直接渲染并启动滚动
42920
42920
  if (this.displayedItems.length === 0) {
42921
42921
  this.displayedItems = newItems;
42922
42922
  this.allAlarmsContainer.innerHTML = '';
42923
42923
  this.totalWidth = 0;
42924
42924
  this.pageWidths = [];
42925
+ // 设置 hasMoreData 状态,防止滚动时误触发 getAlarmData
42926
+ this.hasMoreData = result.totalCount > newItems.length;
42927
+ // 设置初始位置到容器右侧
42928
+ this.currentLeft = this.container.clientWidth;
42929
+ this.allAlarmsContainer.style.left = `${this.currentLeft}px`;
42925
42930
  this.renderNewPage(newItems);
42931
+ // 启动滚动
42932
+ if (!this.isScrolling) {
42933
+ this.initScrolling();
42934
+ }
42926
42935
  return;
42927
42936
  }
42928
- // 保存当前的滚动位置
42929
- const currentScrollPosition = this.currentLeft;
42930
42937
  // 清空所有DOM元素
42931
42938
  this.allAlarmsContainer.innerHTML = '';
42932
42939
  // 获取语言设置
@@ -42989,8 +42996,8 @@ class scroll_alarm_element_ScrollAlarmElement extends conditional_dynamic_displa
42989
42996
  this.totalWidth = newTotalWidth;
42990
42997
  this.pageWidths = [newTotalWidth]; // 重置为单页
42991
42998
  this.hasMoreData = result.totalCount > newItems.length;
42992
- // 保持滚动位置不变,继续滚动
42993
- this.currentLeft = currentScrollPosition;
42999
+ // 收到新告警时,重置滚动位置到容器右侧,确保新内容能被滚动出来显示
43000
+ this.currentLeft = this.container.clientWidth;
42994
43001
  this.allAlarmsContainer.style.left = `${this.currentLeft}px`;
42995
43002
  }
42996
43003
  });