mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-21 12:56:00 +00:00
swithc to form keyboard shortcut
This commit is contained in:
@@ -14,6 +14,7 @@ export default function DataGridContextMenu({
|
|||||||
openFreeTable,
|
openFreeTable,
|
||||||
openChartSelection,
|
openChartSelection,
|
||||||
openActiveChart,
|
openActiveChart,
|
||||||
|
switchToForm,
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -57,6 +58,11 @@ export default function DataGridContextMenu({
|
|||||||
<DropDownMenuItem onClick={openFreeTable}>Open selection in free table editor</DropDownMenuItem>
|
<DropDownMenuItem onClick={openFreeTable}>Open selection in free table editor</DropDownMenuItem>
|
||||||
<DropDownMenuItem onClick={openChartSelection}>Open chart from selection</DropDownMenuItem>
|
<DropDownMenuItem onClick={openChartSelection}>Open chart from selection</DropDownMenuItem>
|
||||||
{openActiveChart && <DropDownMenuItem onClick={openActiveChart}>Open active chart</DropDownMenuItem>}
|
{openActiveChart && <DropDownMenuItem onClick={openActiveChart}>Open active chart</DropDownMenuItem>}
|
||||||
|
{!!switchToForm && (
|
||||||
|
<DropDownMenuItem onClick={switchToForm} keyText="F4">
|
||||||
|
Form view
|
||||||
|
</DropDownMenuItem>
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -382,6 +382,7 @@ export default function DataGridCore(props) {
|
|||||||
openFreeTable={handleOpenFreeTable}
|
openFreeTable={handleOpenFreeTable}
|
||||||
openChartSelection={handleOpenChart}
|
openChartSelection={handleOpenChart}
|
||||||
openActiveChart={openActiveChart}
|
openActiveChart={openActiveChart}
|
||||||
|
switchToForm={handleSwitchToFormView}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -720,6 +721,11 @@ export default function DataGridCore(props) {
|
|||||||
display.reload();
|
display.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (event.keyCode == keycodes.f4) {
|
||||||
|
event.preventDefault();
|
||||||
|
handleSwitchToFormView();
|
||||||
|
}
|
||||||
|
|
||||||
if (event.keyCode == keycodes.s && event.ctrlKey) {
|
if (event.keyCode == keycodes.s && event.ctrlKey) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
handleSave();
|
handleSave();
|
||||||
@@ -950,6 +956,17 @@ export default function DataGridCore(props) {
|
|||||||
}
|
}
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
|
const handleSwitchToFormView =
|
||||||
|
formViewAvailable && display.baseTable && display.baseTable.primaryKey
|
||||||
|
? () => {
|
||||||
|
const cell = currentCell;
|
||||||
|
if (!isRegularCell(cell)) return;
|
||||||
|
const rowData = grider.getRowData(cell[0]);
|
||||||
|
if (!rowData) return;
|
||||||
|
display.switchToFormView(rowData);
|
||||||
|
}
|
||||||
|
: null;
|
||||||
|
|
||||||
// console.log('visibleRealColumnIndexes', visibleRealColumnIndexes);
|
// console.log('visibleRealColumnIndexes', visibleRealColumnIndexes);
|
||||||
// console.log(
|
// console.log(
|
||||||
// 'gridScrollAreaWidth / columnSizes.getVisibleScrollSizeSum()',
|
// 'gridScrollAreaWidth / columnSizes.getVisibleScrollSizeSum()',
|
||||||
@@ -1090,6 +1107,7 @@ export default function DataGridCore(props) {
|
|||||||
await axios.post('database-connections/refresh', { conid, database });
|
await axios.post('database-connections/refresh', { conid, database });
|
||||||
display.reload();
|
display.reload();
|
||||||
}}
|
}}
|
||||||
|
switchToForm={handleSwitchToFormView}
|
||||||
/>,
|
/>,
|
||||||
props.toolbarPortalRef.current
|
props.toolbarPortalRef.current
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -1,9 +1,14 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import ToolbarButton from '../widgets/ToolbarButton';
|
import ToolbarButton from '../widgets/ToolbarButton';
|
||||||
|
|
||||||
export default function DataGridToolbar({ reload, reconnect, grider, save }) {
|
export default function DataGridToolbar({ reload, reconnect, grider, save, switchToForm }) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
{switchToForm && (
|
||||||
|
<ToolbarButton onClick={switchToForm} icon="icon form">
|
||||||
|
Form view
|
||||||
|
</ToolbarButton>
|
||||||
|
)}
|
||||||
<ToolbarButton onClick={reload} icon="icon reload">
|
<ToolbarButton onClick={reload} icon="icon reload">
|
||||||
Refresh
|
Refresh
|
||||||
</ToolbarButton>
|
</ToolbarButton>
|
||||||
|
|||||||
@@ -330,6 +330,11 @@ export default function FormView(props) {
|
|||||||
onReload();
|
onReload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (event.keyCode == keycodes.f4) {
|
||||||
|
event.preventDefault();
|
||||||
|
handleSwitchToTable();
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!event.ctrlKey &&
|
!event.ctrlKey &&
|
||||||
!event.altKey &&
|
!event.altKey &&
|
||||||
|
|||||||
@@ -4,12 +4,22 @@ import { DropDownMenuItem, DropDownMenuDivider } from '../modals/DropDownMenu';
|
|||||||
export default function FormViewContextMenu({ switchToTable, onNavigate }) {
|
export default function FormViewContextMenu({ switchToTable, onNavigate }) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<DropDownMenuItem onClick={switchToTable}>Table view</DropDownMenuItem>
|
<DropDownMenuItem onClick={switchToTable} keyText="F4">
|
||||||
|
Table view
|
||||||
|
</DropDownMenuItem>
|
||||||
<DropDownMenuDivider />
|
<DropDownMenuDivider />
|
||||||
<DropDownMenuItem onClick={() => onNavigate('begin')}>Navigate to begin</DropDownMenuItem>
|
<DropDownMenuItem onClick={() => onNavigate('begin')} keyText="Ctrl+Home">
|
||||||
<DropDownMenuItem onClick={() => onNavigate('previous')}>Navigate to previous</DropDownMenuItem>
|
Navigate to begin
|
||||||
<DropDownMenuItem onClick={() => onNavigate('next')}>Navigate to next</DropDownMenuItem>
|
</DropDownMenuItem>
|
||||||
<DropDownMenuItem onClick={() => onNavigate('end')}>Navigate to end</DropDownMenuItem>
|
<DropDownMenuItem onClick={() => onNavigate('previous')} keyText="Ctrl+Up">
|
||||||
|
Navigate to previous
|
||||||
|
</DropDownMenuItem>
|
||||||
|
<DropDownMenuItem onClick={() => onNavigate('next')} keyText="Ctrl+Down">
|
||||||
|
Navigate to next
|
||||||
|
</DropDownMenuItem>
|
||||||
|
<DropDownMenuItem onClick={() => onNavigate('end')} keyText="Ctrl+End">
|
||||||
|
Navigate to end
|
||||||
|
</DropDownMenuItem>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user