mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-05-03 09:24:00 +00:00
refactor
This commit is contained in:
@@ -585,6 +585,18 @@ export default function DataGridCore(props) {
|
|||||||
copyToClipboard();
|
copyToClipboard();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setCellValue(chs, cell, value) {
|
||||||
|
return setChangeSetValue(
|
||||||
|
chs,
|
||||||
|
display.getChangeSetField(
|
||||||
|
loadedAndInsertedRows[cell[0]],
|
||||||
|
realColumnUniqueNames[cell[1]],
|
||||||
|
cell[0] >= loadedRows.length ? cell[0] - loadedRows.length : null
|
||||||
|
),
|
||||||
|
value
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function handlePaste(event) {
|
function handlePaste(event) {
|
||||||
var pastedText = undefined;
|
var pastedText = undefined;
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
@@ -637,18 +649,9 @@ export default function DataGridCore(props) {
|
|||||||
const [rowIndex, colIndex] = cell;
|
const [rowIndex, colIndex] = cell;
|
||||||
const selectionRow = rowIndex - startRow;
|
const selectionRow = rowIndex - startRow;
|
||||||
const selectionCol = colIndex - startCol;
|
const selectionCol = colIndex - startCol;
|
||||||
const row = allRows[rowIndex];
|
|
||||||
const pasteRow = pasteRows[selectionRow % pasteRows.length];
|
const pasteRow = pasteRows[selectionRow % pasteRows.length];
|
||||||
const pasteCell = pasteRow[selectionCol % pasteRow.length];
|
const pasteCell = pasteRow[selectionCol % pasteRow.length];
|
||||||
chs = setChangeSetValue(
|
chs = setCellValue(chs, cell, pasteCell);
|
||||||
chs,
|
|
||||||
display.getChangeSetField(
|
|
||||||
row,
|
|
||||||
realColumnUniqueNames[colIndex],
|
|
||||||
rowIndex >= loadedRows.length ? rowIndex - loadedRows.length : null
|
|
||||||
),
|
|
||||||
pasteCell
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -658,15 +661,7 @@ export default function DataGridCore(props) {
|
|||||||
function setNull() {
|
function setNull() {
|
||||||
let chs = changeSet;
|
let chs = changeSet;
|
||||||
selectedCells.filter(isRegularCell).forEach((cell) => {
|
selectedCells.filter(isRegularCell).forEach((cell) => {
|
||||||
chs = setChangeSetValue(
|
chs = setCellValue(chs, cell, null);
|
||||||
chs,
|
|
||||||
display.getChangeSetField(
|
|
||||||
loadedAndInsertedRows[cell[0]],
|
|
||||||
realColumnUniqueNames[cell[1]],
|
|
||||||
cell[0] >= loadedRows.length ? cell[0] - loadedRows.length : null
|
|
||||||
),
|
|
||||||
null
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
setChangeSet(chs);
|
setChangeSet(chs);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user