diff --git a/webapp/packages/core-app/src/AppScreen/RightArea.tsx b/webapp/packages/core-app/src/AppScreen/RightArea.tsx index 540a728ea2..34097d383f 100644 --- a/webapp/packages/core-app/src/AppScreen/RightArea.tsx +++ b/webapp/packages/core-app/src/AppScreen/RightArea.tsx @@ -40,8 +40,12 @@ export const RightArea = observer(function RightArea({ className }) { const toolsDisabled = appScreenService.rightAreaBottom.getDisplayed({}).length === 0; + function close() { + optionsPanelService.close(); + } + return ( - + @@ -61,7 +65,7 @@ export const RightArea = observer(function RightArea({ className }) { - optionsPanelService.close()} /> + ); diff --git a/webapp/packages/core-blocks/package.json b/webapp/packages/core-blocks/package.json index 8e274afb71..4448edf506 100644 --- a/webapp/packages/core-blocks/package.json +++ b/webapp/packages/core-blocks/package.json @@ -34,6 +34,7 @@ "mobx": "^6", "mobx-react-lite": "^4", "react": "^18", + "react-hotkeys-hook": "^4", "reakit": "^1", "reakit-utils": "^0" }, diff --git a/webapp/packages/core-blocks/src/Slide/SlideBox.tsx b/webapp/packages/core-blocks/src/Slide/SlideBox.tsx index 85d9210ab6..3a0ee17bfc 100644 --- a/webapp/packages/core-blocks/src/Slide/SlideBox.tsx +++ b/webapp/packages/core-blocks/src/Slide/SlideBox.tsx @@ -8,7 +8,7 @@ import { observer } from 'mobx-react-lite'; import { useEffect, useRef } from 'react'; -import { s, useS } from '../index.js'; +import { s, useHotkeys, useMergeRefs, useS } from '../index.js'; import SlideBoxStyles from './SlideBox.module.css'; import SlideBoxElementStyles from './SlideElement.module.css'; import SlideBoxOverlayStyles from './SlideOverlay.module.css'; @@ -17,13 +17,17 @@ interface Props { className?: string; children?: React.ReactNode; open?: boolean; + onClose?: () => void; } -export const SlideBox = observer(function SlideBox({ children, open, className }) { +export const SlideBox = observer(function SlideBox({ children, open, className, onClose }) { const slideBoxStyles = useS(SlideBoxStyles); const slideBoxElementStyles = useS(SlideBoxElementStyles); const slideBoxOverlayStyles = useS(SlideBoxOverlayStyles); + const divRef = useRef(null); + const ref = useHotkeys('escape', () => onClose?.(), { enabled: open }); + const mergedRefs = useMergeRefs(ref, divRef); useEffect(() => { const div = divRef.current; @@ -48,7 +52,7 @@ export const SlideBox = observer(function SlideBox({ children, open, clas return (
{children} diff --git a/webapp/packages/core-blocks/src/Slide/SlideElement.module.css b/webapp/packages/core-blocks/src/Slide/SlideElement.module.css index 86b9518fec..d25d7a2f17 100644 --- a/webapp/packages/core-blocks/src/Slide/SlideElement.module.css +++ b/webapp/packages/core-blocks/src/Slide/SlideElement.module.css @@ -11,11 +11,11 @@ display: inline-block; vertical-align: top; white-space: normal; - transition: transform ease-in-out 0.4s; + transition: transform ease-in-out 0.3s; transform: translateX(-100%); &:first-child { - transition: width ease-in-out 0.4s; + transition: width ease-in-out 0.3s; width: 100%; } } diff --git a/webapp/packages/core-blocks/src/Slide/SlideOverlay.module.css b/webapp/packages/core-blocks/src/Slide/SlideOverlay.module.css index e33a01932d..3b1ffd7274 100644 --- a/webapp/packages/core-blocks/src/Slide/SlideOverlay.module.css +++ b/webapp/packages/core-blocks/src/Slide/SlideOverlay.module.css @@ -16,7 +16,7 @@ top: 0; left: 0; background: rgb(0 0 0 / 0%); - transition: background cubic-bezier(0.4, 0, 0.2, 1) 0.6s; + transition: background ease-in-out 0.3s; } .iconBtn { diff --git a/webapp/packages/core-blocks/src/index.ts b/webapp/packages/core-blocks/src/index.ts index afdb3f7284..78e9c60fad 100644 --- a/webapp/packages/core-blocks/src/index.ts +++ b/webapp/packages/core-blocks/src/index.ts @@ -5,6 +5,8 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ +export { useHotkeys } from 'react-hotkeys-hook'; + export * from './CommonDialog/CommonDialog/CommonDialogBody.js'; export * from './CommonDialog/CommonDialog/CommonDialogFooter.js'; export * from './CommonDialog/CommonDialog/CommonDialogHeader.js'; diff --git a/webapp/packages/core-view/package.json b/webapp/packages/core-view/package.json index ba234d189a..5290b1f6b5 100644 --- a/webapp/packages/core-view/package.json +++ b/webapp/packages/core-view/package.json @@ -26,8 +26,7 @@ "@cloudbeaver/core-utils": "^0", "mobx": "^6", "mobx-react-lite": "^4", - "react": "^18", - "react-hotkeys-hook": "^4" + "react": "^18" }, "peerDependencies": {}, "devDependencies": { diff --git a/webapp/packages/core-view/src/View/CaptureView.tsx b/webapp/packages/core-view/src/View/CaptureView.tsx index 02c0a17cf8..f675fd2e2d 100644 --- a/webapp/packages/core-view/src/View/CaptureView.tsx +++ b/webapp/packages/core-view/src/View/CaptureView.tsx @@ -7,9 +7,8 @@ */ import { observer } from 'mobx-react-lite'; import { useContext } from 'react'; -import { useHotkeys } from 'react-hotkeys-hook'; -import { s, useFocus, useS } from '@cloudbeaver/core-blocks'; +import { s, useFocus, useHotkeys, useS } from '@cloudbeaver/core-blocks'; import { useService } from '@cloudbeaver/core-di'; import { isObjectsEqual } from '@cloudbeaver/core-utils'; diff --git a/webapp/packages/plugin-administration/src/Administration/Administration.tsx b/webapp/packages/plugin-administration/src/Administration/Administration.tsx index 1e2798b137..14b075389a 100644 --- a/webapp/packages/plugin-administration/src/Administration/Administration.tsx +++ b/webapp/packages/plugin-administration/src/Administration/Administration.tsx @@ -100,6 +100,10 @@ export const Administration = observer>(function contentRef.current?.scrollTo({ top: 0, left: 0 }); }, [activeScreen?.item]); + function close() { + optionsPanelService.close(); + } + return ( @@ -120,7 +124,7 @@ export const Administration = observer>(function
{children} - +
@@ -132,7 +136,7 @@ export const Administration = observer>(function
- optionsPanelService.close()} /> + diff --git a/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/Formatters/CellFormatter.module.css b/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/Formatters/CellFormatter.module.css index f61bab5f30..abbd9a1564 100644 --- a/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/Formatters/CellFormatter.module.css +++ b/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/Formatters/CellFormatter.module.css @@ -10,7 +10,6 @@ display: flex; overflow: hidden; box-sizing: border-box; - position: relative; } .container { @@ -28,8 +27,3 @@ display: none; } } - -.cellMenu { - width: 25px; - height: 100%; -} diff --git a/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/Formatters/CellFormatter.tsx b/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/Formatters/CellFormatter.tsx index 812c964346..549f032835 100644 --- a/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/Formatters/CellFormatter.tsx +++ b/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/Formatters/CellFormatter.tsx @@ -59,7 +59,6 @@ export const CellFormatter = observer(function CellFormatter({ className, spreadsheetActions={spreadsheetActions} resultIndex={context.resultIndex} simple={context.simple} - className={s(styles, { cellMenu: true })} onStateSwitch={setMenuVisible} />
diff --git a/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/Formatters/Menu/CellMenu.module.css b/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/Formatters/Menu/CellMenu.module.css index 7ad2141da9..24fd4d4dbf 100644 --- a/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/Formatters/Menu/CellMenu.module.css +++ b/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/Formatters/Menu/CellMenu.module.css @@ -18,10 +18,15 @@ position: absolute; top: 0px; right: 0px; + height: 100%; } + .menuTrigger { padding: 1px 2px; + display: flex; + align-items: center; height: 100%; + justify-content: center; &:hover { background: none;