@ai-table/grid 0.5.3 → 0.5.5

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,
@@ -12650,6 +12651,7 @@ class RecordDetailComponent {
12650
12651
  this.activeFieldId = null;
12651
12652
  this.fieldMenuActive = signal({}, ...(ngDevMode ? [{ debugName: "fieldMenuActive" }] : []));
12652
12653
  this.fieldMenuPopoverRef = null;
12654
+ this.currentPopoverFieldId = null;
12653
12655
  this.slideRef = inject(ThySlideRef);
12654
12656
  this.thyPopover = inject(ThyPopover);
12655
12657
  effect(() => {
@@ -12665,6 +12667,17 @@ class RecordDetailComponent {
12665
12667
  this.internalRecordId.set(activeCell[0]);
12666
12668
  }
12667
12669
  });
12670
+ effect(() => {
12671
+ const fields = this.fields();
12672
+ if (this.currentPopoverFieldId && this.fieldMenuPopoverRef) {
12673
+ const fieldExists = fields.some((field) => field._id === this.currentPopoverFieldId);
12674
+ if (!fieldExists) {
12675
+ this.fieldMenuPopoverRef.close();
12676
+ this.fieldMenuPopoverRef = null;
12677
+ this.currentPopoverFieldId = null;
12678
+ }
12679
+ }
12680
+ });
12668
12681
  }
12669
12682
  updateRecordId(recordId) {
12670
12683
  this.recordId.set(recordId);
@@ -12695,6 +12708,7 @@ class RecordDetailComponent {
12695
12708
  const origin = e.currentTarget;
12696
12709
  const position = fieldMenuOrigin.getBoundingClientRect();
12697
12710
  this.fieldMenuActive.set({ [fieldId]: true });
12711
+ this.currentPopoverFieldId = fieldId;
12698
12712
  let isSelfClose = false;
12699
12713
  this.fieldMenuPopoverRef =
12700
12714
  this.thyPopover.open(AITableFieldMenu, {
@@ -12720,6 +12734,7 @@ class RecordDetailComponent {
12720
12734
  this.fieldMenuActive.set({ [fieldId]: false });
12721
12735
  }
12722
12736
  this.fieldMenuPopoverRef = null;
12737
+ this.currentPopoverFieldId = null;
12723
12738
  });
12724
12739
  }
12725
12740
  }
@@ -14787,7 +14802,7 @@ class AITableGrid extends AITableGridBase {
14787
14802
  if (!focused) {
14788
14803
  return true;
14789
14804
  }
14790
- const hasAITableGrid = focused.closest('ai-table-grid') !== null || focused.closest('.ai-table-prevent-clear-selection') !== null;
14805
+ const hasAITableGrid = focused.querySelector('ai-table-grid') !== null || focused.closest('.ai-table-prevent-clear-selection') !== null;
14791
14806
  if (!hasAITableGrid) {
14792
14807
  return true;
14793
14808
  }