import { observer } from 'mobx-react-lite' ; import { TreeNode } from '@cloudbeaver/core-blocks' ; import type { NavigationNodeComponent } from '../NavigationNodeComponent' ; import { NavigationNodeControl } from './NavigationNode/NavigationNodeControl' ; import { NavigationNodeNested } from './NavigationNode/NavigationNodeNested' ; import { useNavigationNode } from './useNavigationNode' ; export const NavigationNode = observer ( function NavigationNode ( { node , component , path , expanded : expandedExternal , } ) { const { empty , group , control , disabled , selected , loading , expanded , leaf , handleClick , handleExpand , handleOpen , handleSelect , handleFilter , filterValue , } = useNavigationNode ( node , path ) ; const Control = control || NavigationNodeControl ; if ( leaf || empty ) { expandedExternal = false ; } return ( < TreeNode group = { group } loading = { loading } disabled = { disabled } selected = { selected } expanded = { expanded } externalExpanded = { expandedExternal } leaf = { leaf } filterValue = { filterValue } onExpand = { handleExpand } onClick = { handleClick } onOpen = { handleOpen } onSelect = { handleSelect } onFilter = { handleFilter } > < Control node = { node } /> { ( expanded || expandedExternal ) && < NavigationNodeNested nodeId = { node . id } path = { path } component = { component } / > } < /TreeNode>); } ) ;