mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
find column menu
This commit is contained in:
parent
b551db8774
commit
beef215394
@ -111,11 +111,20 @@
|
||||
id: 'dataGrid.filterSelected',
|
||||
category: 'Data grid',
|
||||
name: 'Filter selected value',
|
||||
keyText: 'Ctrl+F',
|
||||
keyText: 'Ctrl+Shift+F',
|
||||
testEnabled: () => getCurrentDataGrid()?.getDisplay().filterable,
|
||||
onClick: () => getCurrentDataGrid().filterSelectedValue(),
|
||||
});
|
||||
|
||||
registerCommand({
|
||||
id: 'dataGrid.findColumn',
|
||||
category: 'Data grid',
|
||||
name: 'Find colunn',
|
||||
keyText: 'Ctrl+F',
|
||||
testEnabled: () => getCurrentDataGrid() != null,
|
||||
getSubCommands: () => getCurrentDataGrid().buildFindMenu(),
|
||||
});
|
||||
|
||||
registerCommand({
|
||||
id: 'dataGrid.clearFilter',
|
||||
category: 'Data grid',
|
||||
@ -347,6 +356,7 @@
|
||||
});
|
||||
const text = lines.join('\r\n');
|
||||
copyTextToClipboard(text);
|
||||
if (domFocusField) domFocusField.focus();
|
||||
}
|
||||
|
||||
export function loadNextDataIfNeeded() {
|
||||
@ -416,6 +426,25 @@
|
||||
editJsonRowDocument(grider, rowIndex);
|
||||
}
|
||||
|
||||
export function buildFindMenu() {
|
||||
const res = [];
|
||||
for (const column of display.columns) {
|
||||
if (column.uniquePath.length > 1) continue;
|
||||
res.push({
|
||||
text: column.columnName,
|
||||
onClick: async () => {
|
||||
const invMap = _.invert(realColumnUniqueNames);
|
||||
const colIndex = invMap[column.uniqueName];
|
||||
scrollIntoView([null, colIndex]);
|
||||
|
||||
currentCell = [currentCell[0], parseInt(colIndex)];
|
||||
selectedCells = [currentCell];
|
||||
},
|
||||
});
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
$: autofillMarkerCell =
|
||||
selectedCells && selectedCells.length > 0 && _.uniq(selectedCells.map(x => x[0])).length == 1
|
||||
? [_.max(selectedCells.map(x => x[0])), _.max(selectedCells.map(x => x[1]))]
|
||||
@ -927,7 +956,7 @@
|
||||
currentCell = cell;
|
||||
// @ts-ignore
|
||||
selectedCells = [cell];
|
||||
domFocusField.focus();
|
||||
if (domFocusField) domFocusField.focus();
|
||||
};
|
||||
|
||||
const [inplaceEditorState, dispatchInsplaceEditor] = createReducer((state, action) => {
|
||||
|
@ -88,7 +88,7 @@
|
||||
id: 'dataForm.filterSelected',
|
||||
category: 'Data form',
|
||||
name: 'Filter this value',
|
||||
keyText: 'Ctrl+F',
|
||||
keyText: 'Ctrl+Shift+F',
|
||||
testEnabled: () => getCurrentDataForm() != null,
|
||||
onClick: () => getCurrentDataForm().filterSelectedValue(),
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user