Leave table focus on show page click (#3521)
This commit is contained in:
@ -9,6 +9,7 @@ import { entityFieldInitialValueFamilyState } from '@/object-record/field/states
|
|||||||
import { FieldInitialValue } from '@/object-record/field/types/FieldInitialValue';
|
import { FieldInitialValue } from '@/object-record/field/types/FieldInitialValue';
|
||||||
import { EntityDeleteContext } from '@/object-record/record-table/contexts/EntityDeleteHookContext';
|
import { EntityDeleteContext } from '@/object-record/record-table/contexts/EntityDeleteHookContext';
|
||||||
import { useRecordTableStates } from '@/object-record/record-table/hooks/internal/useRecordTableStates';
|
import { useRecordTableStates } from '@/object-record/record-table/hooks/internal/useRecordTableStates';
|
||||||
|
import { useRecordTable } from '@/object-record/record-table/hooks/useRecordTable';
|
||||||
import { useDragSelect } from '@/ui/utilities/drag-select/hooks/useDragSelect';
|
import { useDragSelect } from '@/ui/utilities/drag-select/hooks/useDragSelect';
|
||||||
import { useSetHotkeyScope } from '@/ui/utilities/hotkey/hooks/useSetHotkeyScope';
|
import { useSetHotkeyScope } from '@/ui/utilities/hotkey/hooks/useSetHotkeyScope';
|
||||||
import { HotkeyScope } from '@/ui/utilities/hotkey/types/HotkeyScope';
|
import { HotkeyScope } from '@/ui/utilities/hotkey/types/HotkeyScope';
|
||||||
@ -29,6 +30,8 @@ export const useTableCell = () => {
|
|||||||
const { getObjectMetadataConfigState, getTableRowIdsState } =
|
const { getObjectMetadataConfigState, getTableRowIdsState } =
|
||||||
useRecordTableStates();
|
useRecordTableStates();
|
||||||
|
|
||||||
|
const { leaveTableFocus } = useRecordTable();
|
||||||
|
|
||||||
const objectMetadataConfig = useRecoilValue(getObjectMetadataConfigState());
|
const objectMetadataConfig = useRecoilValue(getObjectMetadataConfigState());
|
||||||
|
|
||||||
const basePathToShowPage = objectMetadataConfig?.basePathToShowPage;
|
const basePathToShowPage = objectMetadataConfig?.basePathToShowPage;
|
||||||
@ -67,6 +70,7 @@ export const useTableCell = () => {
|
|||||||
|
|
||||||
const openTableCell = (options?: { initialValue?: FieldInitialValue }) => {
|
const openTableCell = (options?: { initialValue?: FieldInitialValue }) => {
|
||||||
if (isFirstColumnCell && !isEmpty && basePathToShowPage) {
|
if (isFirstColumnCell && !isEmpty && basePathToShowPage) {
|
||||||
|
leaveTableFocus();
|
||||||
navigate(`${basePathToShowPage}${entityId}`);
|
navigate(`${basePathToShowPage}${entityId}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user