mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-09-24 16:04:36 +08:00
fix(plugin-data-spreadsheet-new): CB-743, CB-851, CB-902, CB-903 run mouse up callback only if grid in focus
This commit is contained in:
-4
@@ -79,10 +79,6 @@ const styles = composes(
|
||||
flex: auto 0 0;
|
||||
}
|
||||
|
||||
IconButton {
|
||||
color: rgba(0, 0, 0, 0.45);
|
||||
}
|
||||
|
||||
StaticImage {
|
||||
width: 32px;
|
||||
max-height: 32px;
|
||||
|
||||
@@ -167,6 +167,7 @@ export const SSH: TabContainerPanelComponent<IConnectionFormTabProps> = observer
|
||||
type='button'
|
||||
mod={['outlined']}
|
||||
disabled={disabled || !enabled || !passwordFilled}
|
||||
loading={loading}
|
||||
onClick={testConnection}
|
||||
>
|
||||
{translate('connections_network_handler_test')}
|
||||
|
||||
+5
-1
@@ -58,6 +58,10 @@ export const CellRenderer: React.FC<CellRendererProps<any>> = observer(function
|
||||
}, [column, rowIdx, selectionContext]);
|
||||
|
||||
const handleMouseUp = useCallback((event: React.MouseEvent<HTMLDivElement, MouseEvent>) => {
|
||||
if (!dataGridContext?.isGridInFocus()) {
|
||||
return;
|
||||
}
|
||||
|
||||
selectionContext?.select(
|
||||
{
|
||||
colIdx: column.idx,
|
||||
@@ -67,7 +71,7 @@ export const CellRenderer: React.FC<CellRendererProps<any>> = observer(function
|
||||
event.shiftKey,
|
||||
false
|
||||
);
|
||||
}, [column, rowIdx, selectionContext]);
|
||||
}, [column, rowIdx, selectionContext, dataGridContext]);
|
||||
|
||||
const handleDoubleClick = useCallback(() => {
|
||||
if (!column.editable) {
|
||||
|
||||
@@ -21,6 +21,7 @@ export interface IDataGridContext {
|
||||
model: IDatabaseDataModel<any>;
|
||||
resultIndex: number;
|
||||
columnResize: IExecutor<IColumnResizeInfo>;
|
||||
isGridInFocus: () => boolean;
|
||||
getEditorPortal: () => HTMLDivElement | null;
|
||||
getDataGridApi: () => DataGridHandle | null;
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ function isAtBottom(event: React.UIEvent<HTMLDivElement>): boolean {
|
||||
}
|
||||
|
||||
export const DataGridTable: React.FC<Props> = observer(function DataGridTable({ model, resultIndex, className }) {
|
||||
const gridContainerRef = useRef<HTMLDivElement>(null);
|
||||
const dataGridRef = useRef<DataGridHandle>(null);
|
||||
const editorRef = useRef<HTMLDivElement>(null);
|
||||
const styles = useStyles(reactGridStyles, baseStyles);
|
||||
@@ -149,6 +150,7 @@ export const DataGridTable: React.FC<Props> = observer(function DataGridTable({
|
||||
model,
|
||||
columnResize,
|
||||
resultIndex,
|
||||
isGridInFocus: () => gridContainerRef.current === document.activeElement,
|
||||
getEditorPortal: () => editorRef.current,
|
||||
getDataGridApi: () => dataGridRef.current,
|
||||
}), [model, resultIndex, editorRef, dataGridRef]);
|
||||
@@ -160,6 +162,7 @@ export const DataGridTable: React.FC<Props> = observer(function DataGridTable({
|
||||
<EditingContext.Provider value={editingContext}>
|
||||
<TableDataContext.Provider value={tableData}>
|
||||
<grid-container
|
||||
ref={gridContainerRef}
|
||||
as='div'
|
||||
className="cb-react-grid-container"
|
||||
tabIndex={-1}
|
||||
|
||||
@@ -34,21 +34,17 @@ export class GISViewerBootstrap extends Bootstrap {
|
||||
const selection = context.model.source.getAction(context.resultIndex, ResultSetSelectAction);
|
||||
const gis = context.model.source.getAction(context.resultIndex, ResultSetGISAction);
|
||||
|
||||
const selectedCells = selection.getSelectedElements();
|
||||
const focusedElement = selection.getFocusedElement();
|
||||
|
||||
if (focusedElement) {
|
||||
if (selectedCells.length === 0) {
|
||||
if (!focusedElement) {
|
||||
return true;
|
||||
}
|
||||
return !gis.isGISFormat(focusedElement);
|
||||
} else {
|
||||
return !gis.isGISFormat(selectedCells[0]);
|
||||
}
|
||||
|
||||
const selectedCells = selection.getSelectedElements();
|
||||
|
||||
if (selectedCells.length > 0) {
|
||||
const firstSelectedCell = selectedCells[0];
|
||||
|
||||
return !gis.isGISFormat(firstSelectedCell);
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user