From 3c8cd31468880fc74b6987d77d2451302f9846d4 Mon Sep 17 00:00:00 2001 From: Ben Merckx Date: Fri, 13 Dec 2024 12:04:04 +0100 Subject: [PATCH] Override enable navigation for parent picker --- src/dashboard/view/entry/NewEntry.tsx | 6 ++---- src/picker/entry/EntryPicker.browser.tsx | 3 ++- src/picker/entry/EntryPicker.ts | 2 ++ 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/dashboard/view/entry/NewEntry.tsx b/src/dashboard/view/entry/NewEntry.tsx index 7469d759..cc13a0cc 100644 --- a/src/dashboard/view/entry/NewEntry.tsx +++ b/src/dashboard/view/entry/NewEntry.tsx @@ -99,11 +99,9 @@ function NewEntryForm({parentId}: NewEntryProps) { const root = useRoot() const parentField = useMemo(() => { return entry('Parent', { - location: { - workspace, - root: root.name - }, + location: {workspace, root: root.name}, condition: {_type: {in: containerTypes}}, + enableNavigation: true, initialValue: preselectedId ? { [Reference.id]: 'parent', diff --git a/src/picker/entry/EntryPicker.browser.tsx b/src/picker/entry/EntryPicker.browser.tsx index e8938e62..b5cbe959 100644 --- a/src/picker/entry/EntryPicker.browser.tsx +++ b/src/picker/entry/EntryPicker.browser.tsx @@ -138,7 +138,8 @@ export function EntryPickerModal({ }) } ) - const withNavigation = Boolean(!options.condition && !options.pickChildren) + const withNavigation = + options.enableNavigation || (!options.condition && !options.pickChildren) const query = useMemo((): QueryWithResult => { const terms = search.replace(/,/g, ' ').split(' ').filter(Boolean) const filter = { diff --git a/src/picker/entry/EntryPicker.ts b/src/picker/entry/EntryPicker.ts index dd543210..604cac9c 100644 --- a/src/picker/entry/EntryPicker.ts +++ b/src/picker/entry/EntryPicker.ts @@ -19,6 +19,8 @@ export interface EntryPickerConditions { pickChildren?: boolean /** Filter entries by a condition */ condition?: Filter + /** Enable entry picker navigation */ + enableNavigation?: boolean } export interface EntryPickerOptions