Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-datasheet-grid

Package Overview
Dependencies
Maintainers
1
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-datasheet-grid - npm Package Compare versions

Comparing version 4.0.6 to 4.1.0

73

dist/components/DataSheetGrid.js

@@ -215,3 +215,7 @@ "use strict";

]);
setActiveCell((a) => ({ col: (a === null || a === void 0 ? void 0 : a.col) || 0, row: row + count }));
setActiveCell((a) => ({
col: (a === null || a === void 0 ? void 0 : a.col) || 0,
row: row + count,
doNotScrollX: true,
}));
}, [createRow, lockRows, onChange, setActiveCell, setSelectionCell]);

@@ -235,6 +239,7 @@ const duplicateRows = react_1.useCallback((rowMin, rowMax = rowMin) => {

]);
setActiveCell({ col: 0, row: rowMax + 1 });
setActiveCell({ col: 0, row: rowMax + 1, doNotScrollX: true });
setSelectionCell({
col: columns.length - (hasStickyRightColumn ? 3 : 2),
row: 2 * rowMax - rowMin + 1,
doNotScrollX: true,
});

@@ -257,16 +262,21 @@ setEditing(false);

}
// Align top
const topMax = cell.row * rowHeight;
// Align bottom
const topMin = (cell.row + 1) * rowHeight + headerRowHeight - height + 1;
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const scrollTop = (_a = listRef.current) === null || _a === void 0 ? void 0 : _a.state.scrollOffset;
if (scrollTop > topMax) {
(_b = listRef.current) === null || _b === void 0 ? void 0 : _b.scrollTo(topMax);
if (!cell.doNotScrollY) {
// Align top
const topMax = cell.row * rowHeight;
// Align bottom
const topMin = (cell.row + 1) * rowHeight + headerRowHeight - height + 1;
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const scrollTop = (_a = listRef.current) === null || _a === void 0 ? void 0 : _a.state.scrollOffset;
if (scrollTop > topMax) {
(_b = listRef.current) === null || _b === void 0 ? void 0 : _b.scrollTo(topMax);
}
else if (scrollTop < topMin) {
(_c = listRef.current) === null || _c === void 0 ? void 0 : _c.scrollTo(topMin);
}
}
else if (scrollTop < topMin) {
(_c = listRef.current) === null || _c === void 0 ? void 0 : _c.scrollTo(topMin);
}
if (columnRights && columnWidths && outerRef.current) {
if (columnRights &&
columnWidths &&
outerRef.current &&
!cell.doNotScrollX) {
// Align left

@@ -335,3 +345,3 @@ const leftMax = columnRights[cell.col] - columnRights[0];

}
return a && Object.assign(Object.assign({}, a), { row });
return a && { col: a.col, row };
});

@@ -377,6 +387,7 @@ setSelectionCell(null);

if (smartDelete && fast_deep_equal_1.default(newData, data)) {
setActiveCell({ col: 0, row: min.row });
setActiveCell({ col: 0, row: min.row, doNotScrollX: true });
setSelectionCell({
col: columns.length - (hasStickyRightColumn ? 3 : 2),
row: max.row,
doNotScrollX: true,
});

@@ -417,3 +428,3 @@ return;

if (nextRow) {
setActiveCell((a) => a && Object.assign(Object.assign({}, a), { row: a.row + 1 }));
setActiveCell((a) => a && { col: a.col, row: a.row + 1 });
}

@@ -653,2 +664,7 @@ }

: Math.max(0, cursorIndex.row),
doNotScrollX: Boolean((rightClickInSelection && activeCell) ||
clickOnStickyRightColumn ||
cursorIndex.col === -1),
doNotScrollY: Boolean((rightClickInSelection && activeCell) ||
cursorIndex.row === -1),
});

@@ -686,10 +702,15 @@ }

let row = cursorIndex.row;
let doNotScrollX = false;
let doNotScrollY = false;
if (cursorIndex.col === -1 || clickOnStickyRightColumn) {
col = columns.length - (hasStickyRightColumn ? 3 : 2);
doNotScrollX = true;
}
if (cursorIndex.row === -1) {
row = data.length - 1;
doNotScrollY = true;
}
if (rightClickOnSelectedHeaders && selectionCell) {
col = selectionCell.col;
doNotScrollY = true;
}

@@ -700,4 +721,5 @@ if ((rightClickOnSelectedGutter ||

row = selectionCell.row;
doNotScrollX = true;
}
setSelectionCell({ col, row });
setSelectionCell({ col, row, doNotScrollX, doNotScrollY });
}

@@ -781,2 +803,4 @@ else {

row: Math.min((_d = activeCell === null || activeCell === void 0 ? void 0 : activeCell.row) !== null && _d !== void 0 ? _d : Infinity, (_e = selection === null || selection === void 0 ? void 0 : selection.min.row) !== null && _e !== void 0 ? _e : Infinity),
doNotScrollX: true,
doNotScrollY: true,
});

@@ -832,2 +856,4 @@ setSelectionCell({

: data.length - 1,
doNotScrollX: !selectionMode.columns,
doNotScrollY: !selectionMode.rows,
});

@@ -1007,6 +1033,13 @@ setEditing(false);

if (!editing) {
setActiveCell({ col: 0, row: 0 });
setActiveCell({
col: 0,
row: 0,
doNotScrollY: true,
doNotScrollX: true,
});
setSelectionCell({
col: columns.length - (hasStickyRightColumn ? 3 : 2),
row: data.length - 1,
doNotScrollY: true,
doNotScrollX: true,
});

@@ -1013,0 +1046,0 @@ event.preventDefault();

@@ -25,3 +25,8 @@ "use strict";

return cell
? Object.assign(Object.assign({}, cell), { colId: (_a = columns[cell.col + 1]) === null || _a === void 0 ? void 0 : _a.id }) : null;
? {
col: cell.col,
row: cell.row,
colId: (_a = columns[cell.col + 1]) === null || _a === void 0 ? void 0 : _a.id,
}
: null;
};

@@ -28,0 +33,0 @@ exports.getCellWithId = getCellWithId;

{
"name": "react-datasheet-grid",
"version": "4.0.6",
"version": "4.1.0",
"description": "An Excel-like React component to create beautiful spreadsheets.",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc