mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-09-24 16:04:36 +08:00
Merge remote-tracking branch 'origin/devel' into devel
This commit is contained in:
@@ -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<Props> = function SlideOverlay({
|
||||
}) {
|
||||
return styled(useStyles(styles))(
|
||||
<div className={className} onClick={onClick}>
|
||||
<icon-btn as='div'>
|
||||
<icon-btn>
|
||||
<Icon name="angle" viewBox="0 0 15 8" />
|
||||
</icon-btn>
|
||||
</div>
|
||||
|
||||
@@ -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', 'В случае бездействия пользователя на протяжении указанного количества минут, его сессия будет закрыта.'],
|
||||
|
||||
+75
-1
@@ -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);
|
||||
},
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+7
-1
@@ -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<Props>(function CellMenu({
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
||||
function markStopPropagation(event: React.MouseEvent<HTMLDivElement, MouseEvent>) {
|
||||
EventContext.set(event, EventStopPropagationFlag);
|
||||
}
|
||||
|
||||
return styled(style)(
|
||||
<cell-menu
|
||||
as='div'
|
||||
onClick={stopPropagation}
|
||||
onMouseDown={markStopPropagation}
|
||||
onMouseUp={markStopPropagation}
|
||||
onDoubleClick={stopPropagation}
|
||||
>
|
||||
<MenuTrigger
|
||||
|
||||
+3
@@ -17,6 +17,9 @@ export const cellMenuStyles = composes(
|
||||
}
|
||||
`,
|
||||
css`
|
||||
:global(.rdg-cell):not(:global(.rdg-cell-selected)):not(:hover) cell-menu {
|
||||
display: none;
|
||||
}
|
||||
cell-menu {
|
||||
flex: 0 0 auto;
|
||||
padding-left: 8px;
|
||||
|
||||
@@ -33,7 +33,7 @@ export const GISValuePresentation = observer<Props>(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);
|
||||
|
||||
Reference in New Issue
Block a user