@ai-table/grid 0.5.4 → 0.5.6

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.
@@ -7566,8 +7566,9 @@ class AITableFieldHead {
7566
7566
  }, ...(ngDevMode ? [{ debugName: "groupConfig" }] : []));
7567
7567
  this.bgConfig = computed(() => {
7568
7568
  const { field, width, height, stroke, isSelected, iconVisible, isFirstHead, showExpandIcon } = this.config();
7569
- const bgWidth = isFirstHead && showExpandIcon ? width + AI_TABLE_ROW_HEAD_EXPAND_WIDTH : width;
7570
- const bgX = isFirstHead && showExpandIcon ? AI_TABLE_OFFSET - AI_TABLE_ROW_HEAD_EXPAND_WIDTH : AI_TABLE_OFFSET;
7569
+ const shouldExtendLeft = isFirstHead && showExpandIcon && !isSelected;
7570
+ const bgWidth = shouldExtendLeft ? width + AI_TABLE_ROW_HEAD_EXPAND_WIDTH : width;
7571
+ const bgX = shouldExtendLeft ? AI_TABLE_OFFSET - AI_TABLE_ROW_HEAD_EXPAND_WIDTH : AI_TABLE_OFFSET;
7571
7572
  return {
7572
7573
  x: bgX,
7573
7574
  y: AI_TABLE_OFFSET,
@@ -8837,6 +8838,15 @@ class AITableScrollableGroup {
8837
8838
  const scrollY = this.scrollY();
8838
8839
  this.scrollPosition.emit({ scrollX, scrollY });
8839
8840
  });
8841
+ // 监听bgName变化,当cell切换时重置滚动位置
8842
+ effect(() => {
8843
+ const currentBgName = this.config().bgName;
8844
+ if (this.previousBgName !== undefined && this.previousBgName !== currentBgName) {
8845
+ this.scrollX.set(0);
8846
+ this.scrollY.set(0);
8847
+ }
8848
+ this.previousBgName = currentBgName;
8849
+ });
8840
8850
  }
8841
8851
  ngAfterViewInit() {
8842
8852
  this.contentTemplate().getNode().moveTo(this.contentGroup.getNode());
@@ -14801,7 +14811,7 @@ class AITableGrid extends AITableGridBase {
14801
14811
  if (!focused) {
14802
14812
  return true;
14803
14813
  }
14804
- const hasAITableGrid = focused.closest('ai-table-grid') !== null || focused.closest('.ai-table-prevent-clear-selection') !== null;
14814
+ const hasAITableGrid = focused.querySelector('ai-table-grid') !== null || focused.closest('.ai-table-prevent-clear-selection') !== null;
14805
14815
  if (!hasAITableGrid) {
14806
14816
  return true;
14807
14817
  }