diff --git a/webapp/packages/plugin-data-spreadsheet-new/src/index.ts b/webapp/packages/plugin-data-spreadsheet-new/src/index.ts index 41f2bea246d..c465e1ac538 100644 --- a/webapp/packages/plugin-data-spreadsheet-new/src/index.ts +++ b/webapp/packages/plugin-data-spreadsheet-new/src/index.ts @@ -7,4 +7,3 @@ */ import './module.js'; -export * from './DataGrid/DATA_GRID_BINDINGS.js'; diff --git a/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/DATA_GRID_BINDINGS.ts b/webapp/packages/plugin-data-viewer/src/DATA_VIEWER_KEY_BINDINGS.ts similarity index 71% rename from webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/DATA_GRID_BINDINGS.ts rename to webapp/packages/plugin-data-viewer/src/DATA_VIEWER_KEY_BINDINGS.ts index a30842c03c0..cbb60ef8a86 100644 --- a/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/DATA_GRID_BINDINGS.ts +++ b/webapp/packages/plugin-data-viewer/src/DATA_VIEWER_KEY_BINDINGS.ts @@ -1,13 +1,12 @@ /* * CloudBeaver - Cloud Database Manager - * Copyright (C) 2020-2024 DBeaver Corp and others + * Copyright (C) 2020-2026 DBeaver Corp and others * * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ import type { IKeyBinding } from '@cloudbeaver/core-view'; -/* these consts are only used for the user interface in Shortcuts popup, actual bindings in DataGridTable.tsx */ export const KEY_BINDING_REVERT_INLINE_EDITOR_CHANGES: IKeyBinding = { id: 'data-viewer-revert-inline-editor-changes', keys: ['Escape'], @@ -26,4 +25,15 @@ export const KEY_BINDING_DUPLICATE_ROW: IKeyBinding = { export const KEY_BINDING_DELETE_ROW: IKeyBinding = { id: 'data-viewer-delete-row', keys: ['Delete'], + keysMac: ['Fn+Backspace'], +}; + +export const KEY_BINDING_SAVE: IKeyBinding = { + id: 'data-viewer-save', + keys: ['mod+shift+s'], +}; + +export const KEY_BINDING_CANCEL: IKeyBinding = { + id: 'data-viewer-cancel', + keys: ['mod+period'], }; diff --git a/webapp/packages/plugin-data-viewer/src/TableViewer/TableFooter/TableFooterMenu/TableFooterMenuService.ts b/webapp/packages/plugin-data-viewer/src/TableViewer/TableFooter/TableFooterMenu/TableFooterMenuService.ts index 439b2a32b57..231e276d154 100644 --- a/webapp/packages/plugin-data-viewer/src/TableViewer/TableFooter/TableFooterMenu/TableFooterMenuService.ts +++ b/webapp/packages/plugin-data-viewer/src/TableViewer/TableFooter/TableFooterMenu/TableFooterMenuService.ts @@ -15,10 +15,6 @@ import { ACTION_SAVE, ActionService, DATA_CONTEXT_MENU, - KEY_BINDING_ADD, - KEY_BINDING_DELETE, - KEY_BINDING_DUPLICATE, - KEY_BINDING_REVERT, KeyBindingService, MenuService, type IAction, @@ -26,6 +22,15 @@ import { import { LocalizationService } from '@cloudbeaver/core-localization'; import type { IDataContextProvider } from '@cloudbeaver/core-data-context'; +import { + KEY_BINDING_ADD_NEW_ROW, + KEY_BINDING_CANCEL, + KEY_BINDING_DELETE_ROW, + KEY_BINDING_DUPLICATE_ROW, + KEY_BINDING_REVERT_INLINE_EDITOR_CHANGES, + KEY_BINDING_SAVE, +} from '../../../DATA_VIEWER_KEY_BINDINGS.js'; + import { DatabaseEditChangeType, IDatabaseDataEditAction } from '../../../DatabaseDataModel/Actions/IDatabaseDataEditAction.js'; import { DATA_CONTEXT_DV_DDM } from '../../../DatabaseDataModel/DataContext/DATA_CONTEXT_DV_DDM.js'; import { DATA_CONTEXT_DV_DDM_RESULT_INDEX } from '../../../DatabaseDataModel/DataContext/DATA_CONTEXT_DV_DDM_RESULT_INDEX.js'; @@ -49,7 +54,7 @@ export class TableFooterMenuService { this.registerEditingActions(); this.keyBindingService.addKeyBindingHandler({ id: 'table-footer-delete', - binding: KEY_BINDING_DELETE, + binding: KEY_BINDING_DELETE_ROW, contexts: [DATA_CONTEXT_DV_DDM, DATA_CONTEXT_DV_DDM_RESULT_INDEX], isBindingApplicable(context, action) { return action === ACTION_DELETE; @@ -59,7 +64,7 @@ export class TableFooterMenuService { this.keyBindingService.addKeyBindingHandler({ id: 'table-footer-revert', - binding: KEY_BINDING_REVERT, + binding: KEY_BINDING_REVERT_INLINE_EDITOR_CHANGES, contexts: [DATA_CONTEXT_DV_DDM, DATA_CONTEXT_DV_DDM_RESULT_INDEX], isBindingApplicable(context, action) { return action === ACTION_REVERT; @@ -69,7 +74,7 @@ export class TableFooterMenuService { this.keyBindingService.addKeyBindingHandler({ id: 'table-footer-add', - binding: KEY_BINDING_ADD, + binding: KEY_BINDING_ADD_NEW_ROW, contexts: [DATA_CONTEXT_DV_DDM, DATA_CONTEXT_DV_DDM_RESULT_INDEX], isBindingApplicable(context, action) { return action === ACTION_ADD; @@ -79,7 +84,7 @@ export class TableFooterMenuService { this.keyBindingService.addKeyBindingHandler({ id: 'table-footer-duplicate', - binding: KEY_BINDING_DUPLICATE, + binding: KEY_BINDING_DUPLICATE_ROW, contexts: [DATA_CONTEXT_DV_DDM, DATA_CONTEXT_DV_DDM_RESULT_INDEX], isBindingApplicable(context, action) { return action === ACTION_DUPLICATE; @@ -87,7 +92,27 @@ export class TableFooterMenuService { handler: this.tableFooterMenuActionHandler.bind(this), }); - this.dataViewerViewService.registerAction(ACTION_DELETE, ACTION_REVERT, ACTION_ADD, ACTION_DUPLICATE); + this.keyBindingService.addKeyBindingHandler({ + id: 'table-footer-save', + binding: KEY_BINDING_SAVE, + contexts: [DATA_CONTEXT_DV_DDM, DATA_CONTEXT_DV_DDM_RESULT_INDEX], + isBindingApplicable(context, action) { + return action === ACTION_SAVE; + }, + handler: this.tableFooterMenuActionHandler.bind(this), + }); + + this.keyBindingService.addKeyBindingHandler({ + id: 'table-footer-cancel', + binding: KEY_BINDING_CANCEL, + contexts: [DATA_CONTEXT_DV_DDM, DATA_CONTEXT_DV_DDM_RESULT_INDEX], + isBindingApplicable(context, action) { + return action === ACTION_CANCEL; + }, + handler: this.tableFooterMenuActionHandler.bind(this), + }); + + this.dataViewerViewService.registerAction(ACTION_DELETE, ACTION_REVERT, ACTION_ADD, ACTION_DUPLICATE, ACTION_CANCEL); } private registerEditingActions() { diff --git a/webapp/packages/plugin-data-viewer/src/index.ts b/webapp/packages/plugin-data-viewer/src/index.ts index 153e64cc6fb..27b5e1c5e95 100644 --- a/webapp/packages/plugin-data-viewer/src/index.ts +++ b/webapp/packages/plugin-data-viewer/src/index.ts @@ -96,3 +96,4 @@ export * from './useDataViewerCopyHandler.js'; export * from './DataViewerSettingsService.js'; export * from './DATA_EDITOR_SETTINGS_GROUP.js'; export * from './MENU_DV_CONTEXT_MENU.js'; +export * from './DATA_VIEWER_KEY_BINDINGS.js'; diff --git a/webapp/packages/plugin-help/package.json b/webapp/packages/plugin-help/package.json index e4a4ab55e2a..4723b022b65 100644 --- a/webapp/packages/plugin-help/package.json +++ b/webapp/packages/plugin-help/package.json @@ -34,7 +34,7 @@ "@cloudbeaver/core-routing": "workspace:*", "@cloudbeaver/core-utils": "workspace:*", "@cloudbeaver/core-view": "workspace:*", - "@cloudbeaver/plugin-data-spreadsheet-new": "workspace:*", + "@cloudbeaver/plugin-data-viewer": "workspace:*", "@cloudbeaver/plugin-navigation-tabs": "workspace:*", "@cloudbeaver/plugin-navigation-tree": "workspace:*", "@cloudbeaver/plugin-object-viewer-nav-tree-link": "workspace:*", diff --git a/webapp/packages/plugin-help/src/Shortcuts/SHORTCUTS_DATA.ts b/webapp/packages/plugin-help/src/Shortcuts/SHORTCUTS_DATA.ts index 337c17e4429..d4b21104674 100644 --- a/webapp/packages/plugin-help/src/Shortcuts/SHORTCUTS_DATA.ts +++ b/webapp/packages/plugin-help/src/Shortcuts/SHORTCUTS_DATA.ts @@ -1,17 +1,27 @@ /* * CloudBeaver - Cloud Database Manager - * Copyright (C) 2020-2025 DBeaver Corp and others + * Copyright (C) 2020-2026 DBeaver Corp and others * * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ import { getOS, OperatingSystem } from '@cloudbeaver/core-utils'; -import { createKeyBinding, getCommonAndOSSpecificKeys, type IKeyBinding, KEY_BINDING_OPEN_IN_TAB, KEY_BINDING_REDO, KEY_BINDING_UNDO } from '@cloudbeaver/core-view'; +import { + createKeyBinding, + getCommonAndOSSpecificKeys, + type IKeyBinding, + KEY_BINDING_OPEN_IN_TAB, + KEY_BINDING_REDO, + KEY_BINDING_UNDO, +} from '@cloudbeaver/core-view'; import { KEY_BINDING_ADD_NEW_ROW, + KEY_BINDING_CANCEL, + KEY_BINDING_DELETE_ROW, KEY_BINDING_DUPLICATE_ROW, KEY_BINDING_REVERT_INLINE_EDITOR_CHANGES, -} from '@cloudbeaver/plugin-data-spreadsheet-new'; + KEY_BINDING_SAVE, +} from '@cloudbeaver/plugin-data-viewer'; import { KEY_BINDING_COLLAPSE_ALL, KEY_BINDING_ENABLE_FILTER } from '@cloudbeaver/plugin-navigation-tree'; import { KEY_BINDING_LINK_OBJECT } from '@cloudbeaver/plugin-object-viewer-nav-tree-link'; import { @@ -53,8 +63,7 @@ const FORMAT_SHORTCUT_KEYS_MAP: Record = { right: '→', pageup: 'pageup', pagedown: 'pagedown', - del: '⌦', - delete: '⌦', + period: '.', }; const SOURCE_DIVIDER_REGEXP = /\+/gi; const APPLIED_DIVIDER = ' + '; @@ -72,11 +81,18 @@ export const DATA_VIEWER_SHORTCUTS: IShortcut[] = [ label: 'data_viewer_shortcut_duplicate_row', code: transformKeys(KEY_BINDING_DUPLICATE_ROW), }, - // disabled - // { - // label: 'data_viewer_shortcut_delete_row', - // code: transformKeys(KEY_BINDING_DELETE_ROW), - // }, + { + label: 'data_viewer_shortcut_delete_row', + code: transformKeys(KEY_BINDING_DELETE_ROW), + }, + { + label: 'ui_processing_save', + code: transformKeys(KEY_BINDING_SAVE), + }, + { + label: 'ui_processing_cancel', + code: transformKeys(KEY_BINDING_CANCEL), + }, ]; export const SQL_EDITOR_SHORTCUTS: IShortcut[] = [ diff --git a/webapp/packages/plugin-help/tsconfig.json b/webapp/packages/plugin-help/tsconfig.json index efdc2605603..0dad48367f9 100644 --- a/webapp/packages/plugin-help/tsconfig.json +++ b/webapp/packages/plugin-help/tsconfig.json @@ -47,7 +47,7 @@ "path": "../core-view" }, { - "path": "../plugin-data-spreadsheet-new" + "path": "../plugin-data-viewer" }, { "path": "../plugin-navigation-tabs" diff --git a/webapp/yarn.lock b/webapp/yarn.lock index 97f980103ed..389e358f280 100644 --- a/webapp/yarn.lock +++ b/webapp/yarn.lock @@ -3242,7 +3242,7 @@ __metadata: "@cloudbeaver/core-routing": "workspace:*" "@cloudbeaver/core-utils": "workspace:*" "@cloudbeaver/core-view": "workspace:*" - "@cloudbeaver/plugin-data-spreadsheet-new": "workspace:*" + "@cloudbeaver/plugin-data-viewer": "workspace:*" "@cloudbeaver/plugin-navigation-tabs": "workspace:*" "@cloudbeaver/plugin-navigation-tree": "workspace:*" "@cloudbeaver/plugin-object-viewer-nav-tree-link": "workspace:*"