mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 06:40:31 +00:00
Merge pull request #371 from bigcapitalhq/big-129-universal-search-should-auto-focus-when-it-opens
fix: Universal search should auto-focus when it opens
This commit is contained in:
@@ -136,6 +136,11 @@ export default {
|
|||||||
type: 'number',
|
type: 'number',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
inventory: {
|
||||||
|
cost_compute_running: {
|
||||||
|
type: 'boolean',
|
||||||
|
},
|
||||||
|
},
|
||||||
accounts: {
|
accounts: {
|
||||||
account_code_required: {
|
account_code_required: {
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
|
|||||||
@@ -5,12 +5,16 @@ import { useHistory } from 'react-router-dom';
|
|||||||
import { getDashboardRoutes } from '@/routes/dashboard';
|
import { getDashboardRoutes } from '@/routes/dashboard';
|
||||||
import withDashboardActions from '@/containers/Dashboard/withDashboardActions';
|
import withDashboardActions from '@/containers/Dashboard/withDashboardActions';
|
||||||
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
||||||
|
import withUniversalSearchActions from '@/containers/UniversalSearch/withUniversalSearchActions';
|
||||||
|
|
||||||
import { compose } from '@/utils';
|
import { compose } from '@/utils';
|
||||||
|
|
||||||
function GlobalHotkeys({
|
function GlobalHotkeys({
|
||||||
// #withDashboardActions
|
// #withDashboardActions
|
||||||
toggleSidebarExpend,
|
toggleSidebarExpand,
|
||||||
|
|
||||||
|
// withUniversalSearchActions
|
||||||
|
openGlobalSearch,
|
||||||
|
|
||||||
// #withDialogActions
|
// #withDialogActions
|
||||||
openDialog,
|
openDialog,
|
||||||
@@ -24,7 +28,7 @@ function GlobalHotkeys({
|
|||||||
.toString();
|
.toString();
|
||||||
|
|
||||||
const handleSidebarToggleBtn = () => {
|
const handleSidebarToggleBtn = () => {
|
||||||
toggleSidebarExpend();
|
toggleSidebarExpand();
|
||||||
};
|
};
|
||||||
useHotkeys(
|
useHotkeys(
|
||||||
globalHotkeys,
|
globalHotkeys,
|
||||||
@@ -37,10 +41,26 @@ function GlobalHotkeys({
|
|||||||
},
|
},
|
||||||
[history],
|
[history],
|
||||||
);
|
);
|
||||||
useHotkeys('ctrl+/', (event, handle) => handleSidebarToggleBtn());
|
useHotkeys('ctrl+/', () => {
|
||||||
useHotkeys('shift+d', (event, handle) => openDialog('money-in', {}));
|
handleSidebarToggleBtn();
|
||||||
useHotkeys('shift+q', (event, handle) => openDialog('money-out', {}));
|
});
|
||||||
|
useHotkeys('shift+d', () => {
|
||||||
|
openDialog('money-in', {});
|
||||||
|
});
|
||||||
|
useHotkeys('shift+q', () => {
|
||||||
|
openDialog('money-out', {});
|
||||||
|
});
|
||||||
|
useHotkeys('/', () => {
|
||||||
|
setTimeout(() => {
|
||||||
|
openGlobalSearch();
|
||||||
|
}, 0);
|
||||||
|
});
|
||||||
|
|
||||||
return <div></div>;
|
return <div></div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default compose(withDashboardActions, withDialogActions)(GlobalHotkeys);
|
export default compose(
|
||||||
|
withDashboardActions,
|
||||||
|
withDialogActions,
|
||||||
|
withUniversalSearchActions,
|
||||||
|
)(GlobalHotkeys);
|
||||||
|
|||||||
@@ -152,6 +152,7 @@ function UniversalSearchBar({ isOpen, onSearchTypeChange, ...listProps }) {
|
|||||||
onSearchTypeChange={onSearchTypeChange}
|
onSearchTypeChange={onSearchTypeChange}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
|
autoFocus={true}
|
||||||
/>
|
/>
|
||||||
{listProps.itemList}
|
{listProps.itemList}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -11,11 +11,10 @@ import { compose } from '@/utils';
|
|||||||
import withUniversalSearchActions from './withUniversalSearchActions';
|
import withUniversalSearchActions from './withUniversalSearchActions';
|
||||||
import withUniversalSearch from './withUniversalSearch';
|
import withUniversalSearch from './withUniversalSearch';
|
||||||
|
|
||||||
|
import { useGetUniversalSearchTypeOptions } from './utils';
|
||||||
import DashboardUniversalSearchItemActions from './DashboardUniversalSearchItemActions';
|
import DashboardUniversalSearchItemActions from './DashboardUniversalSearchItemActions';
|
||||||
import { DashboardUniversalSearchItem } from './components';
|
import { DashboardUniversalSearchItem } from './components';
|
||||||
|
|
||||||
import DashboardUniversalSearchHotkeys from './DashboardUniversalSearchHotkeys';
|
import DashboardUniversalSearchHotkeys from './DashboardUniversalSearchHotkeys';
|
||||||
import { useGetUniversalSearchTypeOptions } from './utils';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dashboard universal search.
|
* Dashboard universal search.
|
||||||
|
|||||||
Reference in New Issue
Block a user