@ai-table/grid 0.3.1 → 0.3.3
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.
| 
         @@ -13745,7 +13745,7 @@ class AITableGrid extends AITableGridBase { 
     | 
|
| 
       13745 
13745 
     | 
    
         
             
                    fromEvent(document, 'copy')
         
     | 
| 
       13746 
13746 
     | 
    
         
             
                        .pipe(takeUntilDestroyed(this.destroyRef))
         
     | 
| 
       13747 
13747 
     | 
    
         
             
                        .subscribe((event) => {
         
     | 
| 
       13748 
     | 
    
         
            -
                        if (this. 
     | 
| 
      
 13748 
     | 
    
         
            +
                        if (this.stopEvent(event)) {
         
     | 
| 
       13749 
13749 
     | 
    
         
             
                            return;
         
     | 
| 
       13750 
13750 
     | 
    
         
             
                        }
         
     | 
| 
       13751 
13751 
     | 
    
         
             
                        const dataTransfer = event.clipboardData;
         
     | 
| 
         @@ -13757,7 +13757,7 @@ class AITableGrid extends AITableGridBase { 
     | 
|
| 
       13757 
13757 
     | 
    
         
             
                    fromEvent(document, 'paste')
         
     | 
| 
       13758 
13758 
     | 
    
         
             
                        .pipe(takeUntilDestroyed(this.destroyRef))
         
     | 
| 
       13759 
13759 
     | 
    
         
             
                        .subscribe((event) => {
         
     | 
| 
       13760 
     | 
    
         
            -
                        if (this. 
     | 
| 
      
 13760 
     | 
    
         
            +
                        if (this.stopEvent(event)) {
         
     | 
| 
       13761 
13761 
     | 
    
         
             
                            return;
         
     | 
| 
       13762 
13762 
     | 
    
         
             
                        }
         
     | 
| 
       13763 
13763 
     | 
    
         
             
                        const dataTransfer = event.clipboardData;
         
     | 
| 
         @@ -13765,6 +13765,37 @@ class AITableGrid extends AITableGridBase { 
     | 
|
| 
       13765 
13765 
     | 
    
         
             
                        event.preventDefault();
         
     | 
| 
       13766 
13766 
     | 
    
         
             
                    });
         
     | 
| 
       13767 
13767 
     | 
    
         
             
                }
         
     | 
| 
      
 13768 
     | 
    
         
            +
                stopEvent(event) {
         
     | 
| 
      
 13769 
     | 
    
         
            +
                    if (this.aiReadonly()) {
         
     | 
| 
      
 13770 
     | 
    
         
            +
                        return true;
         
     | 
| 
      
 13771 
     | 
    
         
            +
                    }
         
     | 
| 
      
 13772 
     | 
    
         
            +
                    const focused = document.activeElement;
         
     | 
| 
      
 13773 
     | 
    
         
            +
                    if (!focused) {
         
     | 
| 
      
 13774 
     | 
    
         
            +
                        return true;
         
     | 
| 
      
 13775 
     | 
    
         
            +
                    }
         
     | 
| 
      
 13776 
     | 
    
         
            +
                    const hasAITableGrid = focused.querySelector('ai-table-grid') !== null;
         
     | 
| 
      
 13777 
     | 
    
         
            +
                    if (!hasAITableGrid) {
         
     | 
| 
      
 13778 
     | 
    
         
            +
                        return true;
         
     | 
| 
      
 13779 
     | 
    
         
            +
                    }
         
     | 
| 
      
 13780 
     | 
    
         
            +
                    const hasSelectedCells = this.aiTable.selection().selectedCells.size > 0;
         
     | 
| 
      
 13781 
     | 
    
         
            +
                    if (!hasSelectedCells) {
         
     | 
| 
      
 13782 
     | 
    
         
            +
                        return true;
         
     | 
| 
      
 13783 
     | 
    
         
            +
                    }
         
     | 
| 
      
 13784 
     | 
    
         
            +
                    const editingCell = this.aiTable.editingCell();
         
     | 
| 
      
 13785 
     | 
    
         
            +
                    if (editingCell && editingCell.path) {
         
     | 
| 
      
 13786 
     | 
    
         
            +
                        return true;
         
     | 
| 
      
 13787 
     | 
    
         
            +
                    }
         
     | 
| 
      
 13788 
     | 
    
         
            +
                    // 检查事件目标是否是输入框或文本区域
         
     | 
| 
      
 13789 
     | 
    
         
            +
                    const target = event.target;
         
     | 
| 
      
 13790 
     | 
    
         
            +
                    if (target.tagName === 'INPUT' || target.tagName === 'TEXTAREA') {
         
     | 
| 
      
 13791 
     | 
    
         
            +
                        return true;
         
     | 
| 
      
 13792 
     | 
    
         
            +
                    }
         
     | 
| 
      
 13793 
     | 
    
         
            +
                    const hasContentEditable = target.contentEditable === 'true';
         
     | 
| 
      
 13794 
     | 
    
         
            +
                    if (hasContentEditable) {
         
     | 
| 
      
 13795 
     | 
    
         
            +
                        return true;
         
     | 
| 
      
 13796 
     | 
    
         
            +
                    }
         
     | 
| 
      
 13797 
     | 
    
         
            +
                    return false;
         
     | 
| 
      
 13798 
     | 
    
         
            +
                }
         
     | 
| 
       13768 
13799 
     | 
    
         
             
                updateDragSelectState(isDragging, startCell) {
         
     | 
| 
       13769 
13800 
     | 
    
         
             
                    this.dragSelectState = {
         
     | 
| 
       13770 
13801 
     | 
    
         
             
                        isDragging: isDragging,
         
     | 
| 
         @@ -13853,32 +13884,7 @@ class AITableGrid extends AITableGridBase { 
     | 
|
| 
       13853 
13884 
     | 
    
         
             
                    fromEvent(document, 'keydown')
         
     | 
| 
       13854 
13885 
     | 
    
         
             
                        .pipe(takeUntilDestroyed(this.destroyRef))
         
     | 
| 
       13855 
13886 
     | 
    
         
             
                        .subscribe(async (event) => {
         
     | 
| 
       13856 
     | 
    
         
            -
                        if (this. 
     | 
| 
       13857 
     | 
    
         
            -
                            return;
         
     | 
| 
       13858 
     | 
    
         
            -
                        }
         
     | 
| 
       13859 
     | 
    
         
            -
                        const focused = document.activeElement;
         
     | 
| 
       13860 
     | 
    
         
            -
                        if (!focused) {
         
     | 
| 
       13861 
     | 
    
         
            -
                            return;
         
     | 
| 
       13862 
     | 
    
         
            -
                        }
         
     | 
| 
       13863 
     | 
    
         
            -
                        const hasAITableGrid = focused.querySelector('ai-table-grid') !== null;
         
     | 
| 
       13864 
     | 
    
         
            -
                        if (!hasAITableGrid) {
         
     | 
| 
       13865 
     | 
    
         
            -
                            return;
         
     | 
| 
       13866 
     | 
    
         
            -
                        }
         
     | 
| 
       13867 
     | 
    
         
            -
                        const hasSelectedCells = this.aiTable.selection().selectedCells.size > 0;
         
     | 
| 
       13868 
     | 
    
         
            -
                        if (!hasSelectedCells) {
         
     | 
| 
       13869 
     | 
    
         
            -
                            return;
         
     | 
| 
       13870 
     | 
    
         
            -
                        }
         
     | 
| 
       13871 
     | 
    
         
            -
                        const editingCell = this.aiTable.editingCell();
         
     | 
| 
       13872 
     | 
    
         
            -
                        if (editingCell && editingCell.path) {
         
     | 
| 
       13873 
     | 
    
         
            -
                            return;
         
     | 
| 
       13874 
     | 
    
         
            -
                        }
         
     | 
| 
       13875 
     | 
    
         
            -
                        // 检查事件目标是否是输入框或文本区域
         
     | 
| 
       13876 
     | 
    
         
            -
                        const target = event.target;
         
     | 
| 
       13877 
     | 
    
         
            -
                        if (target.tagName === 'INPUT' || target.tagName === 'TEXTAREA') {
         
     | 
| 
       13878 
     | 
    
         
            -
                            return;
         
     | 
| 
       13879 
     | 
    
         
            -
                        }
         
     | 
| 
       13880 
     | 
    
         
            -
                        const hasContentEditable = target.contentEditable === 'true';
         
     | 
| 
       13881 
     | 
    
         
            -
                        if (hasContentEditable) {
         
     | 
| 
      
 13887 
     | 
    
         
            +
                        if (this.stopEvent(event)) {
         
     | 
| 
       13882 
13888 
     | 
    
         
             
                            return;
         
     | 
| 
       13883 
13889 
     | 
    
         
             
                        }
         
     | 
| 
       13884 
13890 
     | 
    
         
             
                        const isDeleteOrBackspace = event.key === 'Backspace' || event.key === 'Delete';
         
     |