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 2.0.10 to 2.0.11

26

dist/columns/keyColumn.js

@@ -71,24 +71,32 @@ "use strict";

var _b, _c;
var rowData = _a.rowData;
return (_c = (_b = column.copyValue) === null || _b === void 0 ? void 0 : _b.call(column, { rowData: rowData[key] })) !== null && _c !== void 0 ? _c : null;
var rowData = _a.rowData, rowIndex = _a.rowIndex;
return (_c = (_b = column.copyValue) === null || _b === void 0 ? void 0 : _b.call(column, { rowData: rowData[key], rowIndex: rowIndex })) !== null && _c !== void 0 ? _c : null;
}, deleteValue: function (_a) {
var _b;
var _c, _d;
var rowData = _a.rowData;
return (__assign(__assign({}, rowData), (_b = {}, _b[key] = (_d = (_c = column.deleteValue) === null || _c === void 0 ? void 0 : _c.call(column, { rowData: rowData[key] })) !== null && _d !== void 0 ? _d : null, _b)));
var rowData = _a.rowData, rowIndex = _a.rowIndex;
return (__assign(__assign({}, rowData), (_b = {}, _b[key] = (_d = (_c = column.deleteValue) === null || _c === void 0 ? void 0 : _c.call(column, { rowData: rowData[key], rowIndex: rowIndex })) !== null && _d !== void 0 ? _d : null, _b)));
}, pasteValue: function (_a) {
var _b;
var _c, _d;
var rowData = _a.rowData, value = _a.value;
return (__assign(__assign({}, rowData), (_b = {}, _b[key] = (_d = (_c = column.pasteValue) === null || _c === void 0 ? void 0 : _c.call(column, { rowData: rowData[key], value: value })) !== null && _d !== void 0 ? _d : null, _b)));
var rowData = _a.rowData, value = _a.value, rowIndex = _a.rowIndex;
return (__assign(__assign({}, rowData), (_b = {}, _b[key] = (_d = (_c = column.pasteValue) === null || _c === void 0 ? void 0 : _c.call(column, { rowData: rowData[key], value: value, rowIndex: rowIndex })) !== null && _d !== void 0 ? _d : null, _b)));
}, disabled: typeof column.disabled === 'function'
? function (_a) {
var _b;
var rowData = _a.rowData;
var rowData = _a.rowData, rowIndex = _a.rowIndex;
return typeof column.disabled === 'function'
? column.disabled({ rowData: rowData[key] })
? column.disabled({ rowData: rowData[key], rowIndex: rowIndex })
: (_b = column.disabled) !== null && _b !== void 0 ? _b : false;
}
: column.disabled })); };
: column.disabled, cellClassName: typeof column.cellClassName === 'function'
? function (_a) {
var _b;
var rowData = _a.rowData, rowIndex = _a.rowIndex;
return typeof column.cellClassName === 'function'
? column.cellClassName({ rowData: rowData[key], rowIndex: rowIndex })
: (_b = column.cellClassName) !== null && _b !== void 0 ? _b : undefined;
}
: column.cellClassName })); };
exports.keyColumn = keyColumn;
//# sourceMappingURL=keyColumn.js.map

@@ -127,5 +127,6 @@ "use strict";

};
// eslint-disable-next-line react/display-name
exports.DataSheetGrid = react_1.default.memo(react_1.default.forwardRef(function (_a, ref) {
var _b, _c, _d, _e;
var _f = _a.data, data = _f === void 0 ? DEFAULT_DATA : _f, _g = _a.height, maxHeight = _g === void 0 ? 400 : _g, _h = _a.onChange, onChange = _h === void 0 ? DEFAULT_ON_CHANGE : _h, _j = _a.columns, rawColumns = _j === void 0 ? DEFAULT_COLUMNS : _j, _k = _a.rowHeight, rowHeight = _k === void 0 ? 40 : _k, _l = _a.headerRowHeight, headerRowHeight = _l === void 0 ? rowHeight : _l, gutterColumn = _a.gutterColumn, stickyRightColumn = _a.stickyRightColumn, _m = _a.addRowsComponent, AddRowsComponent = _m === void 0 ? AddRows_1.AddRows : _m, _o = _a.createRow, createRow = _o === void 0 ? DEFAULT_CREATE_ROW : _o, _p = _a.autoAddRow, autoAddRow = _p === void 0 ? false : _p, _q = _a.lockRows, lockRows = _q === void 0 ? false : _q, _r = _a.duplicateRow, duplicateRow = _r === void 0 ? DEFAULT_DUPLICATE_ROW : _r, _s = _a.isRowEmpty, isRowEmpty = _s === void 0 ? DEFAULT_IS_ROW_EMPTY : _s, _t = _a.contextMenuComponent, ContextMenuComponent = _t === void 0 ? ContextMenu_1.ContextMenu : _t, _u = _a.disableContextMenu, disableContextMenuRaw = _u === void 0 ? false : _u;
var _f = _a.data, data = _f === void 0 ? DEFAULT_DATA : _f, className = _a.className, style = _a.style, _g = _a.height, maxHeight = _g === void 0 ? 400 : _g, _h = _a.onChange, onChange = _h === void 0 ? DEFAULT_ON_CHANGE : _h, _j = _a.columns, rawColumns = _j === void 0 ? DEFAULT_COLUMNS : _j, _k = _a.rowHeight, rowHeight = _k === void 0 ? 40 : _k, _l = _a.headerRowHeight, headerRowHeight = _l === void 0 ? rowHeight : _l, gutterColumn = _a.gutterColumn, stickyRightColumn = _a.stickyRightColumn, _m = _a.addRowsComponent, AddRowsComponent = _m === void 0 ? AddRows_1.AddRows : _m, _o = _a.createRow, createRow = _o === void 0 ? DEFAULT_CREATE_ROW : _o, _p = _a.autoAddRow, autoAddRow = _p === void 0 ? false : _p, _q = _a.lockRows, lockRows = _q === void 0 ? false : _q, _r = _a.duplicateRow, duplicateRow = _r === void 0 ? DEFAULT_DUPLICATE_ROW : _r, _s = _a.isRowEmpty, isRowEmpty = _s === void 0 ? DEFAULT_IS_ROW_EMPTY : _s, _t = _a.contextMenuComponent, ContextMenuComponent = _t === void 0 ? ContextMenu_1.ContextMenu : _t, _u = _a.disableContextMenu, disableContextMenuRaw = _u === void 0 ? false : _u;
var disableContextMenu = disableContextMenuRaw || lockRows;

@@ -243,3 +244,6 @@ var columns = useColumns_1.useColumns(rawColumns, gutterColumn, stickyRightColumn);

return Boolean(typeof disabled === 'function'
? disabled({ rowData: dataRef.current[cell.row] })
? disabled({
rowData: dataRef.current[cell.row],
rowIndex: cell.row,
})
: disabled);

@@ -264,3 +268,5 @@ }, [columns]);

.slice(rowMin, rowMax + 1)
.map(function (rowData) { return duplicateRow({ rowData: rowData }); }))), __read(dataRef.current.slice(rowMax + 1))));
.map(function (rowData, i) {
return duplicateRow({ rowData: rowData, rowIndex: i + rowMin });
}))), __read(dataRef.current.slice(rowMax + 1))));
setActiveCell({ col: 0, row: rowMax + 1 });

@@ -371,3 +377,5 @@ setSelectionCell({

.slice(min.row, max.row + 1)
.every(function (rowData) { return isRowEmpty({ rowData: rowData }); })) {
.every(function (rowData, i) {
return isRowEmpty({ rowData: rowData, rowIndex: i + min.row });
})) {
if (smartDelete) {

@@ -386,3 +394,6 @@ deleteRows(min.row, max.row);

} : _a;
newData[row] = deleteValue({ rowData: newData[row] });
newData[row] = deleteValue({
rowData: newData[row],
rowIndex: row,
});
}

@@ -441,3 +452,3 @@ }

var _b = columns[col + 1].copyValue, copyValue = _b === void 0 ? function () { return null; } : _b;
copyData[row - min.row].push(copyValue({ rowData: data[row] }));
copyData[row - min.row].push(copyValue({ rowData: data[row], rowIndex: row }));
}

@@ -492,2 +503,3 @@ }

value: pasteData[0][columnIndex],
rowIndex: rowIndex,
})];

@@ -543,2 +555,3 @@ case 3:

value: pasteData[rowIndex][columnIndex],
rowIndex: min.row + rowIndex,
})];

@@ -1031,3 +1044,3 @@ case 10:

}); });
return (react_1.default.createElement("div", null,
return (react_1.default.createElement("div", { className: className, style: style },
react_1.default.createElement("div", { tabIndex: rawColumns.length && data.length ? 0 : undefined, onFocus: function (e) {

@@ -1034,0 +1047,0 @@ e.target.blur();

@@ -39,5 +39,5 @@ "use strict";

activeColMax >= i - 1 &&
'dsg-cell-header-active') }, column.title)); })));
'dsg-cell-header-active', column.headerClassName) }, column.title)); })));
});
exports.HeaderRow.displayName = 'HeaderRow';
//# sourceMappingURL=HeaderRow.js.map

@@ -75,4 +75,6 @@ "use strict";

(typeof column.disabled === 'function' &&
column.disabled({ rowData: data }));
return (react_1.default.createElement(Cell_1.Cell, { key: i, gutter: i === 0, disabled: disabled, stickyRight: hasStickyRightColumn && i === columns.length - 1, column: column, active: active, className: classnames_1.default(!column.renderWhenScrolling && renderLight && 'dsg-cell-light') }, (column.renderWhenScrolling || !renderLight) && (react_1.default.createElement(Component, { rowData: data, getContextMenuItems: getContextMenuItems, disabled: disabled, active: activeColIndex === i - 1, columnIndex: i - 1, rowIndex: index, focus: activeColIndex === i - 1 && editing, deleteRow: deleteGivenRow, duplicateRow: duplicateGivenRow, stopEditing: activeColIndex === i - 1 && editing && stopEditing
column.disabled({ rowData: data, rowIndex: index }));
return (react_1.default.createElement(Cell_1.Cell, { key: i, gutter: i === 0, disabled: disabled, stickyRight: hasStickyRightColumn && i === columns.length - 1, column: column, active: active, className: classnames_1.default(!column.renderWhenScrolling && renderLight && 'dsg-cell-light', typeof column.cellClassName === 'function'
? column.cellClassName({ rowData: data, rowIndex: index })
: column.cellClassName) }, (column.renderWhenScrolling || !renderLight) && (react_1.default.createElement(Component, { rowData: data, getContextMenuItems: getContextMenuItems, disabled: disabled, active: activeColIndex === i - 1, columnIndex: i - 1, rowIndex: index, focus: activeColIndex === i - 1 && editing, deleteRow: deleteGivenRow, duplicateRow: duplicateGivenRow, stopEditing: activeColIndex === i - 1 && editing && stopEditing
? stopEditing

@@ -79,0 +81,0 @@ : nullfunc, insertRowBelow: insertAfterGivenRow, setRowData: setGivenRowData, columnData: column.columnData }))));

@@ -30,2 +30,3 @@ import React from 'react';

export declare type Column<T, C> = {
headerClassName?: string;
title?: React.ReactNode;

@@ -39,15 +40,23 @@ width: ColumnWidth;

disableKeys: boolean;
disabled: boolean | (({ rowData }: {
disabled: boolean | ((opt: {
rowData: T;
rowIndex: number;
}) => boolean);
cellClassName?: string | ((opt: {
rowData: T;
rowIndex: number;
}) => string | undefined);
keepFocus: boolean;
deleteValue: ({ rowData }: {
deleteValue: (opt: {
rowData: T;
rowIndex: number;
}) => T;
copyValue: ({ rowData }: {
copyValue: (opt: {
rowData: T;
rowIndex: number;
}) => number | string | null;
pasteValue: ({ rowData, value }: {
pasteValue: (opt: {
rowData: T;
value: string;
rowIndex: number;
}) => T;

@@ -142,2 +151,4 @@ };

data?: T[];
style?: React.CSSProperties;
className?: string;
onChange?: (value: T[]) => void;

@@ -154,5 +165,7 @@ columns?: Partial<Column<T, any>>[];

rowData: T;
rowIndex: number;
}) => T;
isRowEmpty?: ({ rowData }: {
rowData: T;
rowIndex: number;
}) => boolean;

@@ -159,0 +172,0 @@ autoAddRow?: boolean;

{
"name": "react-datasheet-grid",
"version": "2.0.10",
"version": "2.0.11",
"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

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