From 8112d757a318cf23282c8f052eb918d7459d9c5c Mon Sep 17 00:00:00 2001 From: sergeyteleshev Date: Fri, 26 Jul 2024 11:19:26 +0200 Subject: [PATCH] CB-3733 removes closeOnMouseWheelClick prop --- .../core-ui/src/SideBarPanel/SideBarPanel.tsx | 2 +- webapp/packages/core-ui/src/Tabs/Tab/Tab.tsx | 2 +- .../packages/core-ui/src/Tabs/Tab/TabDefault.tsx | 13 +------------ webapp/packages/core-ui/src/Tabs/Tab/TabProps.ts | 1 - webapp/packages/core-ui/src/Tabs/TabList.tsx | 3 --- .../NavigationTabsBar/NavigationTabsBar.tsx | 2 +- .../NavigationTabsBar/Tabs/TabHandlerTab.tsx | 5 ++--- .../src/NavigationTabs/TabHandler.ts | 1 - .../plugin-object-viewer/src/ObjectViewerTab.tsx | 16 ++-------------- .../src/SqlEditorTab.tsx | 16 ++-------------- .../src/SqlResultTabs/SqlResultTab.tsx | 13 ++----------- .../src/SqlResultTabs/SqlResultTabs.tsx | 2 +- .../src/ToolsPanel/ToolsPanel.tsx | 2 +- 13 files changed, 14 insertions(+), 64 deletions(-) diff --git a/webapp/packages/core-ui/src/SideBarPanel/SideBarPanel.tsx b/webapp/packages/core-ui/src/SideBarPanel/SideBarPanel.tsx index fa4132eeee..caaf119382 100644 --- a/webapp/packages/core-ui/src/SideBarPanel/SideBarPanel.tsx +++ b/webapp/packages/core-ui/src/SideBarPanel/SideBarPanel.tsx @@ -47,7 +47,7 @@ export const SideBarPanel = observer(function SideBarPanel({
- +
diff --git a/webapp/packages/core-ui/src/Tabs/Tab/Tab.tsx b/webapp/packages/core-ui/src/Tabs/Tab/Tab.tsx index 39e068f5a8..9c185a34a1 100644 --- a/webapp/packages/core-ui/src/Tabs/Tab/Tab.tsx +++ b/webapp/packages/core-ui/src/Tabs/Tab/Tab.tsx @@ -28,7 +28,7 @@ export const Tab = observer(function Tab(props) { const canClose = getComputed(() => !!onClose || (tab.closable && tab.state.closable)); function onMouseUpHandler(event: React.MouseEvent) { - if (event.button === 1 && props.closeOnMouseWheelClick && canClose) { + if (event.button === 1 && canClose) { tab.handleClose(event); } } diff --git a/webapp/packages/core-ui/src/Tabs/Tab/TabDefault.tsx b/webapp/packages/core-ui/src/Tabs/Tab/TabDefault.tsx index e61a365f63..7c03556574 100644 --- a/webapp/packages/core-ui/src/Tabs/Tab/TabDefault.tsx +++ b/webapp/packages/core-ui/src/Tabs/Tab/TabDefault.tsx @@ -24,7 +24,6 @@ interface Props> { component?: React.FC; className?: string; disabled?: boolean; - closeOnMouseWheelClick?: boolean; onOpen?: (tab: ITabData) => void; onClose?: (tab: ITabData) => void; } @@ -34,7 +33,6 @@ export function TabDefault>({ icon, name, component, - closeOnMouseWheelClick, className, disabled, onOpen, @@ -50,7 +48,6 @@ export function TabDefault>({ return ( >({ } return ( - + {icon && } {name && ( diff --git a/webapp/packages/core-ui/src/Tabs/Tab/TabProps.ts b/webapp/packages/core-ui/src/Tabs/Tab/TabProps.ts index fb27453e73..ba0a17ef29 100644 --- a/webapp/packages/core-ui/src/Tabs/Tab/TabProps.ts +++ b/webapp/packages/core-ui/src/Tabs/Tab/TabProps.ts @@ -18,7 +18,6 @@ export type TabProps = PropsWithChildren<{ selected?: boolean; disabled?: boolean; className?: string; - closeOnMouseWheelClick?: boolean; onOpen?: (tab: ITabData) => void; onClose?: (tab: ITabData) => void; onClick?: (tabId: string) => void; diff --git a/webapp/packages/core-ui/src/Tabs/TabList.tsx b/webapp/packages/core-ui/src/Tabs/TabList.tsx index ef8756400c..b68d6b6105 100644 --- a/webapp/packages/core-ui/src/Tabs/TabList.tsx +++ b/webapp/packages/core-ui/src/Tabs/TabList.tsx @@ -27,7 +27,6 @@ export interface TabListProps extends Omit rotated?: boolean; underline?: boolean; big?: boolean; - closeOnMouseWheelClick?: boolean; className?: string; } @@ -38,7 +37,6 @@ export const TabList = observer>(function rotated, underline, big, - closeOnMouseWheelClick, childrenFirst, ...props }) { @@ -74,7 +72,6 @@ export const TabList = observer>(function (tabInfo, key) => ( (function NavigationTabsBar({ cl tabs={ {navigation.tabIdList.map(tabId => ( - + ))} } diff --git a/webapp/packages/plugin-navigation-tabs/src/NavigationTabs/NavigationTabsBar/Tabs/TabHandlerTab.tsx b/webapp/packages/plugin-navigation-tabs/src/NavigationTabs/NavigationTabsBar/Tabs/TabHandlerTab.tsx index 48850a1c16..744425fe5a 100644 --- a/webapp/packages/plugin-navigation-tabs/src/NavigationTabs/NavigationTabsBar/Tabs/TabHandlerTab.tsx +++ b/webapp/packages/plugin-navigation-tabs/src/NavigationTabs/NavigationTabsBar/Tabs/TabHandlerTab.tsx @@ -12,16 +12,15 @@ import { useTabHandler } from './useTabHandler'; interface IProps { tabId: string; - closeOnMouseWheelClick?: boolean; onSelect: (tabId: string) => void; onClose?: (tabId: string) => void; } -export const TabHandlerTab = observer(function TabHandlerTab({ tabId, onSelect, onClose, closeOnMouseWheelClick }) { +export const TabHandlerTab = observer(function TabHandlerTab({ tabId, onSelect, onClose }) { const tab = useTab(tabId); const handler = useTabHandler(tab.handlerId); const TabHandlerTab = handler.getTabComponent(); - return ; + return ; }); diff --git a/webapp/packages/plugin-navigation-tabs/src/NavigationTabs/TabHandler.ts b/webapp/packages/plugin-navigation-tabs/src/NavigationTabs/TabHandler.ts index 067b983a4c..f1c3491797 100644 --- a/webapp/packages/plugin-navigation-tabs/src/NavigationTabs/TabHandler.ts +++ b/webapp/packages/plugin-navigation-tabs/src/NavigationTabs/TabHandler.ts @@ -12,7 +12,6 @@ import type { ITab } from './ITab'; export interface TabHandlerTabProps { tab: ITab; handler: TabHandler; - closeOnMouseWheelClick?: boolean; onSelect: (tabId: string) => void; onClose?: (tabId: string) => void; } diff --git a/webapp/packages/plugin-object-viewer/src/ObjectViewerTab.tsx b/webapp/packages/plugin-object-viewer/src/ObjectViewerTab.tsx index 05d87c6691..6359e7e05b 100644 --- a/webapp/packages/plugin-object-viewer/src/ObjectViewerTab.tsx +++ b/webapp/packages/plugin-object-viewer/src/ObjectViewerTab.tsx @@ -16,12 +16,7 @@ import { useNode } from '@cloudbeaver/plugin-navigation-tree'; import type { IObjectViewerTabState } from './IObjectViewerTabState'; -export const ObjectViewerTab: TabHandlerTabComponent = observer(function ObjectViewerTab({ - tab, - onSelect, - onClose, - closeOnMouseWheelClick, -}) { +export const ObjectViewerTab: TabHandlerTabComponent = observer(function ObjectViewerTab({ tab, onSelect, onClose }) { const viewContext = useContext(CaptureViewContext); const tabMenuContext = useDataContext(viewContext); const { node } = useNode(tab.handlerState.objectId); @@ -30,14 +25,7 @@ export const ObjectViewerTab: TabHandlerTabComponent = ob const title = node?.name || tab.handlerState.tabTitle; return ( - + {title} diff --git a/webapp/packages/plugin-sql-editor-navigation-tab/src/SqlEditorTab.tsx b/webapp/packages/plugin-sql-editor-navigation-tab/src/SqlEditorTab.tsx index 0d61db37fd..6700e23211 100644 --- a/webapp/packages/plugin-sql-editor-navigation-tab/src/SqlEditorTab.tsx +++ b/webapp/packages/plugin-sql-editor-navigation-tab/src/SqlEditorTab.tsx @@ -26,12 +26,7 @@ import { import { DATA_CONTEXT_SQL_EDITOR_TAB } from './DATA_CONTEXT_SQL_EDITOR_TAB'; import sqlEditorTabStyles from './SqlEditorTab.module.css'; -export const SqlEditorTab: TabHandlerTabComponent = observer(function SqlEditorTab({ - tab, - onSelect, - onClose, - closeOnMouseWheelClick, -}) { +export const SqlEditorTab: TabHandlerTabComponent = observer(function SqlEditorTab({ tab, onSelect, onClose }) { const viewContext = useContext(CaptureViewContext); const tabMenuContext = useDataContext(viewContext); const handlerState = tab.handlerState; @@ -65,14 +60,7 @@ export const SqlEditorTab: TabHandlerTabComponent = observer const handleClose = onClose ? ({ tabId }: ITabData) => onClose(tabId) : undefined; return ( - + {name} {isReadonly && isScript && ( diff --git a/webapp/packages/plugin-sql-editor/src/SqlResultTabs/SqlResultTab.tsx b/webapp/packages/plugin-sql-editor/src/SqlResultTabs/SqlResultTab.tsx index 0c831d95a8..a99f3df716 100644 --- a/webapp/packages/plugin-sql-editor/src/SqlResultTabs/SqlResultTab.tsx +++ b/webapp/packages/plugin-sql-editor/src/SqlResultTabs/SqlResultTab.tsx @@ -18,11 +18,10 @@ import { DATA_CONTEXT_SQL_EDITOR_RESULT_ID } from './DATA_CONTEXT_SQL_EDITOR_RES interface Props { result: ISqlEditorResultTab; className?: string; - closeOnMouseWheelClick?: boolean; onClose?: (tab: ITabData) => Promise; } -export const SqlResultTab = observer(function SqlResultTab({ result, className, onClose, closeOnMouseWheelClick }) { +export const SqlResultTab = observer(function SqlResultTab({ result, className, onClose }) { const viewContext = useContext(CaptureViewContext); const tabMenuContext = useDataContext(viewContext); @@ -31,15 +30,7 @@ export const SqlResultTab = observer(function SqlResultTab({ result, clas }); return ( - + {result.name} diff --git a/webapp/packages/plugin-sql-editor/src/SqlResultTabs/SqlResultTabs.tsx b/webapp/packages/plugin-sql-editor/src/SqlResultTabs/SqlResultTabs.tsx index a84495fcac..663e98906e 100644 --- a/webapp/packages/plugin-sql-editor/src/SqlResultTabs/SqlResultTabs.tsx +++ b/webapp/packages/plugin-sql-editor/src/SqlResultTabs/SqlResultTabs.tsx @@ -101,7 +101,7 @@ export const SqlResultTabs = observer(function SqlDataResult({ state, onT {orderedTabs.map(result => ( - + ))} diff --git a/webapp/packages/plugin-tools-panel/src/ToolsPanel/ToolsPanel.tsx b/webapp/packages/plugin-tools-panel/src/ToolsPanel/ToolsPanel.tsx index 0082973485..7c0ca0ed63 100644 --- a/webapp/packages/plugin-tools-panel/src/ToolsPanel/ToolsPanel.tsx +++ b/webapp/packages/plugin-tools-panel/src/ToolsPanel/ToolsPanel.tsx @@ -62,7 +62,7 @@ export const ToolsPanel = observer(function ToolsPanel() { return (
- +