Skip to content

Commit

Permalink
Merge branch 'devel' into CB-5811-incorrect-highlighting-of-a-non-edi…
Browse files Browse the repository at this point in the history
…table-field
  • Loading branch information
dariamarutkina authored Oct 15, 2024
2 parents 1a7cb4b + 7427543 commit 31c6ca4
Show file tree
Hide file tree
Showing 12 changed files with 32 additions and 21 deletions.
8 changes: 6 additions & 2 deletions webapp/packages/core-app/src/AppScreen/RightArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,12 @@ export const RightArea = observer<Props>(function RightArea({ className }) {

const toolsDisabled = appScreenService.rightAreaBottom.getDisplayed({}).length === 0;

function close() {
optionsPanelService.close();
}

return (
<SlideBox open={optionsPanelService.active} className={s(styles, { slideBox: true }, className)}>
<SlideBox open={optionsPanelService.active} className={s(styles, { slideBox: true }, className)} onClose={close}>
<SlideElement>
<Loader className={s(styles, { loader: true })} suspense>
<OptionsPanel />
Expand All @@ -61,7 +65,7 @@ export const RightArea = observer<Props>(function RightArea({ className }) {
</Loader>
</Pane>
</Split>
<SlideOverlay onClick={() => optionsPanelService.close()} />
<SlideOverlay onClick={close} />
</SlideElement>
</SlideBox>
);
Expand Down
1 change: 1 addition & 0 deletions webapp/packages/core-blocks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"mobx": "^6",
"mobx-react-lite": "^4",
"react": "^18",
"react-hotkeys-hook": "^4",
"reakit": "^1",
"reakit-utils": "^0"
},
Expand Down
10 changes: 7 additions & 3 deletions webapp/packages/core-blocks/src/Slide/SlideBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -17,13 +17,17 @@ interface Props {
className?: string;
children?: React.ReactNode;
open?: boolean;
onClose?: () => void;
}

export const SlideBox = observer<Props>(function SlideBox({ children, open, className }) {
export const SlideBox = observer<Props>(function SlideBox({ children, open, className, onClose }) {
const slideBoxStyles = useS(SlideBoxStyles);
const slideBoxElementStyles = useS(SlideBoxElementStyles);
const slideBoxOverlayStyles = useS(SlideBoxOverlayStyles);

const divRef = useRef<HTMLDivElement>(null);
const ref = useHotkeys('escape', () => onClose?.(), { enabled: open });
const mergedRefs = useMergeRefs(ref, divRef);

useEffect(() => {
const div = divRef.current;
Expand All @@ -48,7 +52,7 @@ export const SlideBox = observer<Props>(function SlideBox({ children, open, clas

return (
<div
ref={divRef}
ref={mergedRefs}
className={s(slideBoxStyles, { slideBox: true }, s(slideBoxElementStyles, { open }), s(slideBoxOverlayStyles, { open }), className)}
>
{children}
Expand Down
4 changes: 2 additions & 2 deletions webapp/packages/core-blocks/src/Slide/SlideElement.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -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%;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions webapp/packages/core-blocks/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
3 changes: 1 addition & 2 deletions webapp/packages/core-view/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
"@cloudbeaver/core-utils": "^0",
"mobx": "^6",
"mobx-react-lite": "^4",
"react": "^18",
"react-hotkeys-hook": "^4"
"react": "^18"
},
"peerDependencies": {},
"devDependencies": {
Expand Down
3 changes: 1 addition & 2 deletions webapp/packages/core-view/src/View/CaptureView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ export const Administration = observer<React.PropsWithChildren<Props>>(function
contentRef.current?.scrollTo({ top: 0, left: 0 });
}, [activeScreen?.item]);

function close() {
optionsPanelService.close();
}

return (
<CaptureView view={administrationViewService} className={s(styles, { captureView: true })}>
<AdministrationCaptureViewContext />
Expand All @@ -120,7 +124,7 @@ export const Administration = observer<React.PropsWithChildren<Props>>(function
<div ref={contentRef} className={s(styles, { contentContainer: true })}>
{children}
<SContext registry={adminPageRegistry}>
<SlideBox className={s(styles, { slideBox: true })} open={optionsPanelService.active}>
<SlideBox className={s(styles, { slideBox: true })} open={optionsPanelService.active} onClose={close}>
<SlideElement className={s(styles, { slideElement: true })}>
<Loader className={s(styles, { loader: true })} suspense>
<div className={s(styles, { content: true })}>
Expand All @@ -132,7 +136,7 @@ export const Administration = observer<React.PropsWithChildren<Props>>(function
<div className={s(styles, { content: true })}>
<ItemContent activeScreen={activeScreen} configurationWizard={configurationWizard} />
</div>
<SlideOverlay onClick={() => optionsPanelService.close()} />
<SlideOverlay onClick={close} />
</SlideElement>
</SlideBox>
</SContext>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
display: flex;
overflow: hidden;
box-sizing: border-box;
position: relative;
}

.container {
Expand All @@ -28,8 +27,3 @@
display: none;
}
}

.cellMenu {
width: 25px;
height: 100%;
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ export const CellFormatter = observer<Props>(function CellFormatter({ className,
spreadsheetActions={spreadsheetActions}
resultIndex={context.resultIndex}
simple={context.simple}
className={s(styles, { cellMenu: true })}
onStateSwitch={setMenuVisible}
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 31c6ca4

Please sign in to comment.