mirror of
https://github.com/rowyio/rowy.git
synced 2026-05-18 05:05:28 +02:00
updated RDG, copy paste function
This commit is contained in:
@@ -34,7 +34,7 @@
|
||||
"react": "^16.9.0",
|
||||
"react-beautiful-dnd": "^13.0.0",
|
||||
"react-color": "^2.17.3",
|
||||
"react-data-grid": "^7.0.0-canary.27",
|
||||
"react-data-grid": "7.0.0-canary.30",
|
||||
"react-div-100vh": "^0.3.8",
|
||||
"react-dnd": "^11.1.3",
|
||||
"react-dnd-html5-backend": "^11.1.3",
|
||||
|
||||
@@ -187,8 +187,6 @@ export default function Table() {
|
||||
rowHeight={rowHeight ?? 43}
|
||||
headerRowHeight={44}
|
||||
className="rdg-light" // Handle dark mode in MUI theme
|
||||
enableCellCopyPaste
|
||||
enableCellDragAndDrop
|
||||
cellNavigationMode="LOOP_OVER_ROW"
|
||||
rowKeyGetter={rowKeyGetter}
|
||||
selectedRows={selectedRowsSet}
|
||||
@@ -218,22 +216,20 @@ export default function Table() {
|
||||
});
|
||||
setSelectedRowsSet(newSelectedSet);
|
||||
}}
|
||||
onRowsUpdate={(e) => {
|
||||
const { action, fromRow, toRow, updated, cellKey } = e;
|
||||
switch (action) {
|
||||
case "CELL_UPDATE":
|
||||
break;
|
||||
case "CELL_DRAG":
|
||||
const rows2update = toRow > fromRow ? [...rows].splice(fromRow, toRow - fromRow + 1):[...rows].splice(toRow, fromRow - toRow + 1)
|
||||
rows2update.forEach((row) => {
|
||||
if (updateCell) {
|
||||
updateCell(row.ref, cellKey, updated[cellKey])
|
||||
}
|
||||
});
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
onRowsChange={(rows)=>{
|
||||
//console.log('onRowsChange',rows)
|
||||
}}
|
||||
onFill={(e)=>{
|
||||
console.log('onFill',e)
|
||||
const {columnKey, sourceRow,targetRows} = e
|
||||
if(updateCell)targetRows.forEach(row=>updateCell(row.ref, columnKey, sourceRow[columnKey]))
|
||||
return []
|
||||
}}
|
||||
onPaste={e=>{
|
||||
const copiedValue = e.sourceRow[e.sourceColumnKey]
|
||||
if(updateCell){
|
||||
console.log(e.sourceRow.ref, e.targetColumnKey, copiedValue)
|
||||
updateCell(e.targetRow.ref, e.targetColumnKey, copiedValue)}
|
||||
}}
|
||||
onRowClick={(rowIdx, column) => {
|
||||
if (sideDrawerRef?.current) {
|
||||
|
||||
@@ -12379,10 +12379,10 @@ react-color@^2.19.3:
|
||||
reactcss "^1.2.0"
|
||||
tinycolor2 "^1.4.1"
|
||||
|
||||
react-data-grid@^7.0.0-canary.27:
|
||||
version "7.0.0-canary.27"
|
||||
resolved "https://registry.yarnpkg.com/react-data-grid/-/react-data-grid-7.0.0-canary.27.tgz#764ca52b7935eb9024339a58ed34af6e1e22f05a"
|
||||
integrity sha512-PQLHeA85j3rvXH4/5eytxT31Xutx5+UPTZpMra85tx/wE++ErWTEjpdL6D+ReV+AcOs+GUzAPh8f1kuehNdawg==
|
||||
react-data-grid@7.0.0-canary.30:
|
||||
version "7.0.0-canary.30"
|
||||
resolved "https://registry.yarnpkg.com/react-data-grid/-/react-data-grid-7.0.0-canary.30.tgz#779cf014abcebc41a4635c22519beb3f183e64c1"
|
||||
integrity sha512-NxGqaHnjHBWTh2eBCae5bb57+N3UBy9DQLnlg3JUZ1ggRnruXDl9Qgci6Xg2XwLdJBC5i0B0F0MbeKTucgArJA==
|
||||
dependencies:
|
||||
clsx "^1.1.1"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user