diff --git a/packages/web/src/datagrid/DataGridCore.svelte b/packages/web/src/datagrid/DataGridCore.svelte index 68f4df9be..4d32958fe 100644 --- a/packages/web/src/datagrid/DataGridCore.svelte +++ b/packages/web/src/datagrid/DataGridCore.svelte @@ -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) => { diff --git a/packages/web/src/formview/FormView.svelte b/packages/web/src/formview/FormView.svelte index 2392bcb87..5496e517f 100644 --- a/packages/web/src/formview/FormView.svelte +++ b/packages/web/src/formview/FormView.svelte @@ -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(), });