@rowsncolumns/grid
Advanced tools
Comparing version 3.2.8 to 3.2.9
@@ -664,6 +664,10 @@ "use strict"; | ||
if (showGridLines) { | ||
// Horizontal | ||
for (let rowIndex = rowStartIndex; rowIndex <= rowStopIndex; rowIndex++) { | ||
/* Ignore frozen rows */ | ||
if (rowIndex < frozenRows) | ||
continue; | ||
const x1 = 0; | ||
const x2 = helpers_1.getColumnOffset({ | ||
index: columnStopIndex, | ||
index: Math.min(columnStopIndex + 1, columnCount), | ||
rowHeight, | ||
@@ -674,3 +678,3 @@ columnWidth, | ||
const y1 = helpers_1.getRowOffset({ | ||
index: rowIndex, | ||
index: Math.min(rowIndex + 1, rowCount), | ||
rowHeight, | ||
@@ -694,5 +698,6 @@ columnWidth, | ||
} | ||
// Vertical | ||
for (let columnIndex = columnStartIndex; columnIndex <= columnStopIndex; columnIndex++) { | ||
const x1 = helpers_1.getColumnOffset({ | ||
index: columnIndex, | ||
index: Math.min(columnIndex + 1, columnCount), | ||
rowHeight, | ||
@@ -705,3 +710,3 @@ columnWidth, | ||
const y2 = helpers_1.getRowOffset({ | ||
index: rowStopIndex, | ||
index: Math.min(rowStopIndex + 1, rowCount), | ||
rowHeight, | ||
@@ -727,3 +732,3 @@ columnWidth, | ||
const x2 = helpers_1.getColumnOffset({ | ||
index: columnStopIndex, | ||
index: Math.min(columnStopIndex + 1, columnCount), | ||
rowHeight, | ||
@@ -734,3 +739,3 @@ columnWidth, | ||
const y1 = helpers_1.getRowOffset({ | ||
index: rowIndex, | ||
index: Math.min(rowIndex + 1, rowCount), | ||
rowHeight, | ||
@@ -756,3 +761,3 @@ columnWidth, | ||
const x1 = helpers_1.getColumnOffset({ | ||
index: columnIndex, | ||
index: Math.min(columnIndex + 1, columnCount), | ||
rowHeight, | ||
@@ -765,3 +770,3 @@ columnWidth, | ||
const y2 = helpers_1.getRowOffset({ | ||
index: rowStopIndex, | ||
index: Math.min(rowStopIndex + 1, rowCount), | ||
rowHeight, | ||
@@ -768,0 +773,0 @@ columnWidth, |
@@ -62,3 +62,3 @@ import React from "react"; | ||
*/ | ||
setActiveCell: (coords: CellInterface | null) => void; | ||
setActiveCell: (coords: CellInterface | null, shouldScroll?: boolean) => void; | ||
/** | ||
@@ -65,0 +65,0 @@ * Array of all selection bounds |
@@ -515,3 +515,3 @@ "use strict"; | ||
*/ | ||
const handleSetActiveCell = react_1.useCallback((coords) => { | ||
const handleSetActiveCell = react_1.useCallback((coords, shouldScroll = true) => { | ||
selectionStart.current = coords; | ||
@@ -522,3 +522,3 @@ firstActiveCell.current = coords; | ||
/* Scroll to the cell */ | ||
if (coords && (gridRef === null || gridRef === void 0 ? void 0 : gridRef.current)) { | ||
if (shouldScroll && coords && (gridRef === null || gridRef === void 0 ? void 0 : gridRef.current)) { | ||
gridRef.current.scrollToItem(coords); | ||
@@ -525,0 +525,0 @@ } |
{ | ||
"name": "@rowsncolumns/grid", | ||
"description": "Declarative React Canvas Grid primitive for Data table, Pivot table, Excel Worksheets", | ||
"version": "3.2.8", | ||
"version": "3.2.9", | ||
"main": "dist/index.js", | ||
@@ -44,3 +44,3 @@ "license": "MIT", | ||
}, | ||
"gitHead": "4ce8fe8206a1fa0ad3e2c983f9df27471020dcb1" | ||
"gitHead": "ee7cd5aa8f78b79fdc5b340fafac6c9d9a688751" | ||
} |
@@ -77,3 +77,3 @@ import React, { useState, useCallback, useRef, useEffect } from "react"; | ||
*/ | ||
setActiveCell: (coords: CellInterface | null) => void; | ||
setActiveCell: (coords: CellInterface | null, shouldScroll?: boolean) => void; | ||
/** | ||
@@ -705,12 +705,15 @@ * Array of all selection bounds | ||
*/ | ||
const handleSetActiveCell = useCallback((coords: CellInterface | null) => { | ||
selectionStart.current = coords; | ||
firstActiveCell.current = coords; | ||
selectionEnd.current = coords; | ||
setActiveCell(coords); | ||
/* Scroll to the cell */ | ||
if (coords && gridRef?.current) { | ||
gridRef.current.scrollToItem(coords); | ||
} | ||
}, []); | ||
const handleSetActiveCell = useCallback( | ||
(coords: CellInterface | null, shouldScroll = true) => { | ||
selectionStart.current = coords; | ||
firstActiveCell.current = coords; | ||
selectionEnd.current = coords; | ||
setActiveCell(coords); | ||
/* Scroll to the cell */ | ||
if (shouldScroll && coords && gridRef?.current) { | ||
gridRef.current.scrollToItem(coords); | ||
} | ||
}, | ||
[] | ||
); | ||
@@ -717,0 +720,0 @@ const handleFillHandleMouseDown = useCallback( |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
506963
10867