react-datasheet-grid
Advanced tools
Comparing version 3.3.9 to 3.4.0
@@ -196,2 +196,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
...dataRef.current.slice(row + 1), | ||
], [ | ||
{ | ||
type: 'CREATE', | ||
fromRowIndex: row + 1, | ||
toRowIndex: row + 1 + count, | ||
}, | ||
]); | ||
@@ -210,2 +216,8 @@ setActiveCell((a) => ({ col: (a === null || a === void 0 ? void 0 : a.col) || 0, row: row + count })); | ||
...dataRef.current.slice(rowMax + 1), | ||
], [ | ||
{ | ||
type: 'CREATE', | ||
fromRowIndex: rowMax + 1, | ||
toRowIndex: rowMax + 2 + rowMax - rowMin, | ||
}, | ||
]); | ||
@@ -292,2 +304,8 @@ setActiveCell({ col: 0, row: rowMax + 1 }); | ||
...(_b = dataRef.current) === null || _b === void 0 ? void 0 : _b.slice(rowIndex + 1), | ||
], [ | ||
{ | ||
type: 'UPDATE', | ||
fromRowIndex: rowIndex, | ||
toRowIndex: rowIndex + 1, | ||
}, | ||
]); | ||
@@ -311,2 +329,8 @@ }, [onChange]); | ||
...dataRef.current.slice(rowMax + 1), | ||
], [ | ||
{ | ||
type: 'DELETE', | ||
fromRowIndex: rowMin, | ||
toRowIndex: rowMax + 1, | ||
}, | ||
]); | ||
@@ -348,3 +372,9 @@ }, [lockRows, onChange, setActiveCell, setSelectionCell]); | ||
} | ||
onChange(newData); | ||
onChange(newData, [ | ||
{ | ||
type: 'UPDATE', | ||
fromRowIndex: min.row, | ||
toRowIndex: max.row + 1, | ||
}, | ||
]); | ||
}, [ | ||
@@ -445,3 +475,9 @@ activeCell, | ||
} | ||
onChange(newData); | ||
onChange(newData, [ | ||
{ | ||
type: 'UPDATE', | ||
fromRowIndex: min.row, | ||
toRowIndex: max.row + 1, | ||
}, | ||
]); | ||
setActiveCell({ col: min.col, row: min.row }); | ||
@@ -487,3 +523,19 @@ setSelectionCell({ | ||
} | ||
onChange(newData); | ||
const operations = [ | ||
{ | ||
type: 'UPDATE', | ||
fromRowIndex: min.row, | ||
toRowIndex: min.row + | ||
pasteData.length - | ||
(!lockRows && missingRows > 0 ? missingRows : 0), | ||
}, | ||
]; | ||
if (missingRows > 0 && !lockRows) { | ||
operations.push({ | ||
type: 'CREATE', | ||
fromRowIndex: min.row + pasteData.length - missingRows, | ||
toRowIndex: min.row + pasteData.length, | ||
}); | ||
} | ||
onChange(newData, operations); | ||
setActiveCell({ col: min.col, row: min.row }); | ||
@@ -688,3 +740,9 @@ setSelectionCell({ | ||
} | ||
onChange(newData); | ||
onChange(newData, [ | ||
{ | ||
type: 'UPDATE', | ||
fromRowIndex: max.row + 1, | ||
toRowIndex: max.row + 1 + expandSelectionRowsCount, | ||
}, | ||
]); | ||
setExpandSelectionRowsCount(0); | ||
@@ -691,0 +749,0 @@ setActiveCell({ |
@@ -153,2 +153,7 @@ import React from 'react'; | ||
}; | ||
export declare type Operation = { | ||
type: 'UPDATE' | 'DELETE' | 'CREATE'; | ||
fromRowIndex: number; | ||
toRowIndex: number; | ||
}; | ||
export declare type DataSheetGridProps<T> = { | ||
@@ -158,3 +163,3 @@ value?: T[]; | ||
className?: string; | ||
onChange?: (value: T[]) => void; | ||
onChange?: (value: T[], operations: Operation[]) => void; | ||
columns?: Partial<Column<T, any>>[]; | ||
@@ -161,0 +166,0 @@ gutterColumn?: SimpleColumn<T, any> | false; |
{ | ||
"name": "react-datasheet-grid", | ||
"version": "3.3.9", | ||
"version": "3.4.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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
251000
2928