From 9d49648e279520ff4bf19c71a430e79eea40a834 Mon Sep 17 00:00:00 2001 From: Naumov Alexey Date: Thu, 7 Oct 2021 16:54:36 +0300 Subject: [PATCH 1/3] fix(plugin-gis-viewer): CB-1180 use copy of selection.elements instead of computed --- webapp/packages/plugin-administration/src/locales/ru.ts | 2 +- webapp/packages/plugin-gis-viewer/src/GISValuePresentation.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/webapp/packages/plugin-administration/src/locales/ru.ts b/webapp/packages/plugin-administration/src/locales/ru.ts index eace4390a3..1fd428cbc9 100644 --- a/webapp/packages/plugin-administration/src/locales/ru.ts +++ b/webapp/packages/plugin-administration/src/locales/ru.ts @@ -5,7 +5,7 @@ export default [ ['administration_configuration_wizard_configuration', 'Настройки сервера'], ['administration_configuration_wizard_configuration_server_info', 'Информация о сервере'], - ['administration_configuration_wizard_configuration_server_name', 'Назвение сервера'], + ['administration_configuration_wizard_configuration_server_name', 'Название сервера'], ['administration_configuration_wizard_configuration_server_info_unsaved', 'Есть несохранённые изменения'], ['administration_configuration_wizard_configuration_server_session_lifetime', 'Время сессии'], ['administration_configuration_wizard_configuration_server_session_lifetime_description', 'В случае бездействия пользователя на протяжении указанного количества минут, его сессия будет закрыта.'], diff --git a/webapp/packages/plugin-gis-viewer/src/GISValuePresentation.tsx b/webapp/packages/plugin-gis-viewer/src/GISValuePresentation.tsx index ff760d370f..0bff04cca1 100644 --- a/webapp/packages/plugin-gis-viewer/src/GISValuePresentation.tsx +++ b/webapp/packages/plugin-gis-viewer/src/GISValuePresentation.tsx @@ -33,7 +33,7 @@ export const GISValuePresentation = observer(function GISValuePresentatio const view = model.source.getAction(resultIndex, ResultSetViewAction); const focusedCell = selection.getFocusedElement(); - const selectedCells = selection.elements; + const selectedCells = selection.elements.slice(); if (selectedCells.length === 0 && focusedCell) { selectedCells.push(focusedCell); From c2a74ebaea5ac92a2a306af1eacf6b59eff4f046 Mon Sep 17 00:00:00 2001 From: Naumov Alexey Date: Thu, 7 Oct 2021 17:19:50 +0300 Subject: [PATCH 2/3] fix(core-blocks): CB-811 set width to SlideOverlay arrow icon --- webapp/packages/core-blocks/src/Slide/SlideOverlay.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/webapp/packages/core-blocks/src/Slide/SlideOverlay.tsx b/webapp/packages/core-blocks/src/Slide/SlideOverlay.tsx index 5241ad9a15..c1dca36b83 100644 --- a/webapp/packages/core-blocks/src/Slide/SlideOverlay.tsx +++ b/webapp/packages/core-blocks/src/Slide/SlideOverlay.tsx @@ -36,6 +36,9 @@ const styles = composes( align-items: center; transform: rotate(90deg); } + Icon { + width: 100%; + } ` ); @@ -45,7 +48,7 @@ export const SlideOverlay: React.FC = function SlideOverlay({ }) { return styled(useStyles(styles))(
- +
From a1a7ededa947893f84bd37bbdee4f3275d848213 Mon Sep 17 00:00:00 2001 From: Wroud Date: Thu, 7 Oct 2021 18:23:53 +0300 Subject: [PATCH 3/3] feat(plugin-data-spreadsheet-new): CB-1181 revert and delete selected cells from context menu --- .../DataGridContextMenuCellEditingService.ts | 76 ++++++++++++++++++- .../src/DataGrid/Formatters/Menu/CellMenu.tsx | 8 +- .../Formatters/Menu/cellMenuStyles.ts | 3 + 3 files changed, 85 insertions(+), 2 deletions(-) diff --git a/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/DataGridContextMenu/DataGridContextMenuCellEditingService.ts b/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/DataGridContextMenu/DataGridContextMenuCellEditingService.ts index 14f994b54c..27dcba81ad 100644 --- a/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/DataGridContextMenu/DataGridContextMenuCellEditingService.ts +++ b/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/DataGridContextMenu/DataGridContextMenuCellEditingService.ts @@ -7,7 +7,7 @@ */ import { injectable } from '@cloudbeaver/core-di'; -import { isBooleanValuePresentationAvailable, DatabaseEditChangeType, ResultSetEditAction, ResultSetFormatAction, ResultSetViewAction } from '@cloudbeaver/plugin-data-viewer'; +import { isBooleanValuePresentationAvailable, DatabaseEditChangeType, ResultSetEditAction, ResultSetFormatAction, ResultSetViewAction, DatabaseSelectAction, ResultSetSelectAction } from '@cloudbeaver/plugin-data-viewer'; import { DataGridContextMenuService } from './DataGridContextMenuService'; @@ -123,6 +123,10 @@ export class DataGridContextMenuCellEditingService { return context.contextType === DataGridContextMenuService.cellContext; }, isHidden(context) { + if (context.data.model.isReadonly()) { + return true; + } + const editor = context.data.model.source.getAction(context.data.resultIndex, ResultSetEditAction); const format = context.data.model.source.getAction(context.data.resultIndex, ResultSetFormatAction); return ( @@ -136,6 +140,44 @@ export class DataGridContextMenuCellEditingService { }, } ); + this.dataGridContextMenuService.add( + this.getMenuEditingToken(), + { + id: 'row_delete_selected', + order: 6.1, + icon: '/icons/data_delete_sm.svg', + title: 'data_viewer_action_edit_delete', + isPresent(context) { + return context.contextType === DataGridContextMenuService.cellContext; + }, + isHidden(context) { + if (context.data.model.isReadonly()) { + return true; + } + + const editor = context.data.model.source.getAction(context.data.resultIndex, ResultSetEditAction); + const select = context.data.model.source.getActionImplementation( + context.data.resultIndex, + ResultSetSelectAction + ); + + const selectedElements = select?.getSelectedElements() || []; + + return !selectedElements.some(key => editor.getElementState(key) !== DatabaseEditChangeType.delete); + }, + onClick(context) { + const editor = context.data.model.source.getAction(context.data.resultIndex, ResultSetEditAction); + const select = context.data.model.source.getActionImplementation( + context.data.resultIndex, + ResultSetSelectAction + ); + + const selectedElements = select?.getSelectedElements() || []; + + editor?.delete(...selectedElements); + }, + } + ); this.dataGridContextMenuService.add( this.getMenuEditingToken(), { @@ -156,5 +198,37 @@ export class DataGridContextMenuCellEditingService { }, } ); + this.dataGridContextMenuService.add( + this.getMenuEditingToken(), + { + id: 'row_revert_selected', + order: 7.1, + icon: '/icons/data_revert_sm.svg', + title: 'data_viewer_action_edit_revert', + isPresent(context) { + return context.contextType === DataGridContextMenuService.cellContext; + }, + isHidden(context) { + const editor = context.data.model.source.getAction(context.data.resultIndex, ResultSetEditAction); + const select = context.data.model.source.getActionImplementation( + context.data.resultIndex, + ResultSetSelectAction + ); + + const selectedElements = select?.getSelectedElements() || []; + return !selectedElements.some(key => editor.getElementState(key) !== null); + }, + onClick(context) { + const editor = context.data.model.source.getAction(context.data.resultIndex, ResultSetEditAction); + const select = context.data.model.source.getActionImplementation( + context.data.resultIndex, + ResultSetSelectAction + ); + + const selectedElements = select?.getSelectedElements() || []; + editor.revert(...selectedElements); + }, + } + ); } } diff --git a/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/Formatters/Menu/CellMenu.tsx b/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/Formatters/Menu/CellMenu.tsx index 66596865a2..ee14239c10 100644 --- a/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/Formatters/Menu/CellMenu.tsx +++ b/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/Formatters/Menu/CellMenu.tsx @@ -12,6 +12,7 @@ import styled from 'reshadow'; import { Icon } from '@cloudbeaver/core-blocks'; import { useService } from '@cloudbeaver/core-di'; import { MenuTrigger } from '@cloudbeaver/core-dialogs'; +import { EventContext, EventStopPropagationFlag } from '@cloudbeaver/core-events'; import { useStyles } from '@cloudbeaver/core-theming'; import type { IDatabaseDataModel, IDataPresentationActions, IDataTableActions, IResultSetElementKey } from '@cloudbeaver/plugin-data-viewer'; @@ -57,10 +58,15 @@ export const CellMenu = observer(function CellMenu({ event.stopPropagation(); } + function markStopPropagation(event: React.MouseEvent) { + EventContext.set(event, EventStopPropagationFlag); + } + return styled(style)(