@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.
@@ -37,8 +37,8 @@ export class ScrollAlarmElement extends ConditionalDynamicDisplayElement {
37
37
  this.variableCommunicator = variableCommunicator;
38
38
  this.autoCycle = (_b = (_a = this.model.generalSetting) === null || _a === void 0 ? void 0 : _a.autoCycle) !== null && _b !== void 0 ? _b : true;
39
39
  this.maxResultCount = (_d = (_c = this.model.generalSetting) === null || _c === void 0 ? void 0 : _c.pageSize) !== null && _d !== void 0 ? _d : 500;
40
- // 检测是否是模拟运行模式(通过检查 alarmsStore 的类型)
41
- this.isSimulateMode = alarmsStore && alarmsStore.constructor.name === 'SimulateAlarmDataStore';
40
+ // 检测是否是模拟运行模式(通过检查 alarmsStore 的标记属性,不受代码混淆影响)
41
+ this.isSimulateMode = alarmsStore && alarmsStore.isSimulationStore === true;
42
42
  if (this.model.filterSetting && this.model.filterSetting.detailsData && this.model.filterSetting.detailsData.length > 0) {
43
43
  this.alarmNames = this.model.filterSetting.detailsData.map(item => item.name);
44
44
  // 如果是模拟运行模式,使用静态显示逻辑(类似设计态)
@@ -286,7 +286,6 @@ export class ScrollAlarmElement extends ConditionalDynamicDisplayElement {
286
286
  this.allAlarmsContainer = document.createElement('div');
287
287
  this.allAlarmsContainer.style.cssText = `
288
288
  position: absolute;
289
- left: ${elementWidth}px;
290
289
  top: 50%;
291
290
  transform: translateY(-50%);
292
291
  display: flex;
@@ -296,6 +295,7 @@ export class ScrollAlarmElement extends ConditionalDynamicDisplayElement {
296
295
  this.container.appendChild(this.allAlarmsContainer);
297
296
  // 设置初始位置为容器宽度,让内容从右侧滚入
298
297
  this.currentLeft = elementWidth;
298
+ this.allAlarmsContainer.style.left = `${elementWidth}px`;
299
299
  // 添加鼠标悬停暂停和恢复滚动功能
300
300
  this.container.addEventListener('mouseenter', () => this.pauseScroll());
301
301
  this.container.addEventListener('mouseleave', () => this.resumeScroll());
@@ -604,27 +604,28 @@ export class ScrollAlarmElement extends ConditionalDynamicDisplayElement {
604
604
  }
605
605
  // 设置文本内容
606
606
  textContainer.textContent = textParts.join(' ');
607
- this.allAlarmsContainer.appendChild(textContainer);
608
- // 计算文本宽度
609
- const textWidth = textContainer.offsetWidth;
610
- this.totalWidth = textWidth;
611
- this.pageWidths.push(textWidth);
612
- // 设置初始位置为容器宽度(从右侧滚入)
613
- this.currentLeft = this.container.clientWidth;
607
+ // 使用配置的宽度,而不是 clientWidth(因为DOM可能还没渲染完成)
608
+ const containerWidth = this.model.size.width;
609
+ // 先设置容器位置到右侧(屏幕外),这样添加元素时不会闪烁
610
+ this.currentLeft = containerWidth;
614
611
  this.allAlarmsContainer.style.left = `${this.currentLeft}px`;
615
- // 根据 autoCycle 配置决定是否启动滚动
616
- if (this.autoCycle) {
612
+ // 添加到DOM以便计算宽度
613
+ this.allAlarmsContainer.appendChild(textContainer);
614
+ // 使用 setTimeout 确保 DOM 渲染完成后再计算宽度
615
+ setTimeout(() => {
616
+ // 计算文本宽度
617
+ const textWidth = textContainer.offsetWidth;
618
+ this.totalWidth = textWidth;
619
+ this.pageWidths.push(textWidth);
620
+ // 启动滚动(autoCycle 只控制是否循环,不控制是否滚动)
617
621
  this.initStaticScrolling();
618
- }
622
+ }, 50);
619
623
  }
620
624
  /**
621
625
  * 模拟运行时的静态滚动逻辑
622
626
  */
623
627
  initStaticScrolling() {
624
628
  clearInterval(this.scrollIntervalId);
625
- // 确保初始位置在容器右侧
626
- this.currentLeft = this.container.clientWidth;
627
- this.allAlarmsContainer.style.left = `${this.currentLeft}px`;
628
629
  const scrollInterval = 100;
629
630
  // 延迟启动滚动确保内容渲染完成
630
631
  setTimeout(() => {
@@ -644,11 +645,17 @@ export class ScrollAlarmElement extends ConditionalDynamicDisplayElement {
644
645
  const scrollStep = 2;
645
646
  // 更新位置 - 从右往左滚动
646
647
  this.currentLeft -= scrollStep;
647
- // 当内容完全滚出容器左侧时
648
- if (this.currentLeft + this.totalWidth < 0) {
648
+ // 更新显示位置
649
+ this.allAlarmsContainer.style.left = `${this.currentLeft}px`;
650
+ // 当内容完全滚出容器左侧时(内容右边缘完全移出容器左边缘)
651
+ // currentLeft + totalWidth 表示内容右边缘的位置
652
+ // 当这个值 <= 0 时,表示内容右边缘已经到达或超过容器左边缘,内容完全不可见
653
+ const rightEdge = this.currentLeft + this.totalWidth;
654
+ if (rightEdge <= 0) {
649
655
  if (this.autoCycle) {
650
- // 自动循环模式:重置到容器右侧
651
- this.currentLeft = this.container.clientWidth;
656
+ // 自动循环模式:重置到容器右侧(使用配置宽度)
657
+ this.currentLeft = this.model.size.width;
658
+ this.allAlarmsContainer.style.left = `${this.currentLeft}px`;
652
659
  }
653
660
  else {
654
661
  // 非循环模式:停止滚动
@@ -657,7 +664,5 @@ export class ScrollAlarmElement extends ConditionalDynamicDisplayElement {
657
664
  return;
658
665
  }
659
666
  }
660
- // 更新显示位置
661
- this.allAlarmsContainer.style.left = `${this.currentLeft}px`;
662
667
  }
663
668
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "main": "bundles/fc-gui.umd.js",
3
- "version": "3.0.0-alpha.131",
3
+ "version": "3.0.0-alpha.133",
4
4
  "module": "public_api.js",
5
5
  "typings": "public_api.d.ts",
6
6
  "license": "UNLICENSED",