diff --git a/packages/grid/src/Grid.tsx b/packages/grid/src/Grid.tsx index dcbc809b5d..f56bd01cf7 100644 --- a/packages/grid/src/Grid.tsx +++ b/packages/grid/src/Grid.tsx @@ -1497,6 +1497,7 @@ class Grid extends PureComponent { const { columnCount, rowCount } = model; let ranges = selectedRanges; // If each cell is a single selection, we need to update the selection to map to the newly pasted data + // Check for if ( ranges.every( range => @@ -1518,16 +1519,6 @@ class Grid extends PureComponent { this.setSelectedRanges(ranges); } - if ( - !ranges.every( - range => - GridRange.rowCount([range]) === tableHeight && - GridRange.columnCount([range]) === tableWidth - ) - ) { - throw new PasteError('Copy and paste area are not same size.'); - } - const edits: EditOperation[] = []; ranges.forEach(range => { for (let x = 0; x < tableWidth; x += 1) { diff --git a/packages/iris-grid/src/IrisGridTableModelTemplate.ts b/packages/iris-grid/src/IrisGridTableModelTemplate.ts index 017b32e445..0cd4166e74 100644 --- a/packages/iris-grid/src/IrisGridTableModelTemplate.ts +++ b/packages/iris-grid/src/IrisGridTableModelTemplate.ts @@ -1036,7 +1036,7 @@ class IrisGridTableModelTemplate< */ pendingRow(y: ModelIndex): ModelIndex | null { const pendingRow = y - this.floatingTopRowCount - this.table.size; - if (pendingRow >= 0 && pendingRow < this.pendingNewRowCount) { + if (pendingRow >= 0) { return pendingRow; } @@ -1633,7 +1633,11 @@ class IrisGridTableModelTemplate< isEditableRange(range: GridRange): boolean { // Make sure we have an input table and a valid range - if (this.inputTable == null || !GridRange.isBounded(range)) { + if ( + this.inputTable == null || + range.startRow == null || + range.endRow == null + ) { return false; } @@ -1645,12 +1649,10 @@ class IrisGridTableModelTemplate< this.isPendingRow(range.startRow) && this.isPendingRow(range.endRow); let isKeyColumnInRange = false; + assertNotNull(range.startColumn); // Check if any of the columns in grid range are key columns - for ( - let column = range.startColumn; - column <= range.endColumn; - column += 1 - ) { + const bound = range.endColumn ?? this.table.size; + for (let column = range.startColumn; column <= bound; column += 1) { if (this.isKeyColumn(column)) { isKeyColumnInRange = true; break; @@ -1663,17 +1665,6 @@ class IrisGridTableModelTemplate< return false; } - // Editing the aggregations/totals which are floating above/below is not allowed - if ( - range.startRow < this.floatingTopRowCount || - range.startRow >= - this.floatingTopRowCount + this.table.size + this.pendingRowCount || - range.endRow >= - this.floatingTopRowCount + this.table.size + this.pendingRowCount - ) { - return false; - } - return true; }