mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-30 12:43:58 +00:00
refactor
This commit is contained in:
@@ -437,19 +437,25 @@
|
|||||||
|
|
||||||
export function buildFindMenu() {
|
export function buildFindMenu() {
|
||||||
const res = [];
|
const res = [];
|
||||||
|
|
||||||
|
async function clickColumn(uniquePath) {
|
||||||
|
display.setColumnVisibility(uniquePath, true);
|
||||||
|
await tick();
|
||||||
|
const invMap = _.invert(realColumnUniqueNames);
|
||||||
|
const colIndex = invMap[uniquePath.join('.')];
|
||||||
|
scrollIntoView([null, colIndex]);
|
||||||
|
|
||||||
|
currentCell = [currentCell[0], parseInt(colIndex)];
|
||||||
|
selectedCells = [currentCell];
|
||||||
|
}
|
||||||
|
|
||||||
for (const column of display.columns) {
|
for (const column of display.columns) {
|
||||||
if (column.uniquePath.length > 1) continue;
|
if (column.uniquePath.length > 1) continue;
|
||||||
|
|
||||||
res.push({
|
res.push({
|
||||||
text: column.columnName,
|
text: column.columnName,
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
display.setColumnVisibility(column.uniquePath, true);
|
clickColumn(column.uniquePath);
|
||||||
await tick();
|
|
||||||
const invMap = _.invert(realColumnUniqueNames);
|
|
||||||
const colIndex = invMap[column.uniqueName];
|
|
||||||
scrollIntoView([null, colIndex]);
|
|
||||||
|
|
||||||
currentCell = [currentCell[0], parseInt(colIndex)];
|
|
||||||
selectedCells = [currentCell];
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -463,16 +469,8 @@
|
|||||||
res.push({
|
res.push({
|
||||||
text: `${column.columnName}.${childColumn.columnName}`,
|
text: `${column.columnName}.${childColumn.columnName}`,
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
const uniquePath = [...column.uniquePath, childColumn.columnName];
|
|
||||||
display.setColumnVisibility(uniquePath, true);
|
|
||||||
display.toggleExpandedColumn(column.uniqueName, true);
|
display.toggleExpandedColumn(column.uniqueName, true);
|
||||||
await tick();
|
clickColumn([...column.uniquePath, childColumn.columnName]);
|
||||||
const invMap = _.invert(realColumnUniqueNames);
|
|
||||||
const colIndex = invMap[uniquePath.join('.')];
|
|
||||||
scrollIntoView([null, colIndex]);
|
|
||||||
|
|
||||||
currentCell = [currentCell[0], parseInt(colIndex)];
|
|
||||||
selectedCells = [currentCell];
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user