Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion webapp/packages/plugin-data-spreadsheet-new/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@
*/

import './module.js';
export * from './DataGrid/DATA_GRID_BINDINGS.js';
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2024 DBeaver Corp and others
* Copyright (C) 2020-2025 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'],
Expand All @@ -27,3 +26,13 @@ export const KEY_BINDING_DELETE_ROW: IKeyBinding = {
id: 'data-viewer-delete-row',
keys: ['Delete'],
};

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+escape'],
};
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,22 @@ import {
ACTION_SAVE,
ActionService,
DATA_CONTEXT_MENU,
KEY_BINDING_ADD,
KEY_BINDING_DELETE,
KEY_BINDING_DUPLICATE,
KEY_BINDING_REVERT,
KeyBindingService,
MenuService,
type IAction,
} from '@cloudbeaver/core-view';
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';
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -79,15 +84,35 @@ 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;
},
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() {
Expand Down
1 change: 1 addition & 0 deletions webapp/packages/plugin-data-viewer/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
2 changes: 1 addition & 1 deletion webapp/packages/plugin-help/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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:*",
Expand Down
33 changes: 24 additions & 9 deletions webapp/packages/plugin-help/src/Shortcuts/SHORTCUTS_DATA.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,22 @@
* 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 {
Expand Down Expand Up @@ -53,8 +63,6 @@ const FORMAT_SHORTCUT_KEYS_MAP: Record<string, string> = {
right: '→',
pageup: 'pageup',
pagedown: 'pagedown',
del: '⌦',
delete: '⌦',
};
const SOURCE_DIVIDER_REGEXP = /\+/gi;
const APPLIED_DIVIDER = ' + ';
Expand All @@ -72,11 +80,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[] = [
Expand Down
2 changes: 1 addition & 1 deletion webapp/packages/plugin-help/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"path": "../core-view"
},
{
"path": "../plugin-data-spreadsheet-new"
"path": "../plugin-data-viewer"
},
{
"path": "../plugin-navigation-tabs"
Expand Down
2 changes: 1 addition & 1 deletion webapp/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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:*"
Expand Down
Loading