- {tree.map((item) =>
+ {hierarchy.tree.map((item) =>
item ? (
@@ -201,7 +212,7 @@ const ValueSetTable = ({
onChangePage(page)}
color="#0063AF"
/>
diff --git a/src/components/SearchValueSet/index.tsx b/src/components/SearchValueSet/index.tsx
index faa1cd98f..ed23a046c 100644
--- a/src/components/SearchValueSet/index.tsx
+++ b/src/components/SearchValueSet/index.tsx
@@ -9,8 +9,9 @@ import SelectedCodes from 'components/Hierarchy/SelectedCodes'
import { useSearchValueSet } from 'hooks/valueSet/useSearchValueSet'
import { Displayer } from 'components/ui/Displayer/styles'
import ClearIcon from '@mui/icons-material/Clear'
-import { FhirItem, Hierarchy, SearchMode, SearchModeLabel } from 'types/hierarchy'
+import { FhirItem, Hierarchy, Mode, SearchMode, SearchModeLabel } from 'types/hierarchy'
import { cleanNode } from 'utils/hierarchy/hierarchy'
+import { HIERARCHY_ROOT } from 'services/aphp/serviceValueSets'
type SearchValueSetProps = {
references: Reference[]
@@ -23,10 +24,12 @@ const SearchValueSet = ({ references, selectedNodes, onSelect }: SearchValueSetP
mode,
searchInput,
onChangeMode,
+ onDelete,
selectedCodes,
+ isSelectionDisabled,
loadingStatus,
parameters: { refs, onChangeReferences, onChangeSearchInput, onChangePage },
- hierarchy: { exploration, research, selectAllStatus, expand, select, selectAll }
+ hierarchy: { exploration, research, selectAllStatus, expand, select }
} = useSearchValueSet(references, selectedNodes)
const tabs: TabType[] = [
@@ -98,8 +101,8 @@ const SearchValueSet = ({ references, selectedNodes, onSelect }: SearchValueSetP
loading={{ list: loadingStatus.init, expand: loadingStatus.expand }}
hierarchy={exploration}
selectAllStatus={selectAllStatus}
+ isSelectionDisabled={isSelectionDisabled}
onSelect={select}
- onSelectAll={selectAll}
onExpand={expand}
onChangePage={onChangePage}
/>
@@ -111,8 +114,8 @@ const SearchValueSet = ({ references, selectedNodes, onSelect }: SearchValueSetP
isHierarchy={false}
loading={{ list: loadingStatus.search, expand: loadingStatus.expand }}
hierarchy={research}
+ isSelectionDisabled={isSelectionDisabled}
onSelect={select}
- onSelectAll={selectAll}
onExpand={expand}
onChangePage={onChangePage}
/>
@@ -121,7 +124,7 @@ const SearchValueSet = ({ references, selectedNodes, onSelect }: SearchValueSetP
- select(code, false)} />
+
>
diff --git a/src/hooks/hierarchy/useHierarchy.ts b/src/hooks/hierarchy/useHierarchy.ts
index 48aa20767..3deefbac0 100644
--- a/src/hooks/hierarchy/useHierarchy.ts
+++ b/src/hooks/hierarchy/useHierarchy.ts
@@ -2,20 +2,20 @@ import {
buildTree,
buildMultipleTrees,
getHierarchyDisplay,
- getItemSelectedStatus,
getListDisplay,
getMissingCodes,
getMissingCodesWithSystems,
groupBySystem,
getHierarchyRootCodes,
mapHierarchyToMap,
- getSelectedCodesFromTrees
+ getSelectedCodesFromTrees,
+ createHierarchyRoot
} from '../../utils/hierarchy/hierarchy'
-import { useEffect, useMemo, useRef, useState } from 'react'
+import { useEffect, useRef, useState } from 'react'
import { Back_API_Response, LoadingStatus, SelectedStatus } from 'types'
-import { getSelectedCodesFromTree } from 'utils/hierarchy/hierarchy'
import { Codes, Hierarchy, HierarchyInfo, HierarchyLoadingStatus, Mode, SearchMode } from '../../types/hierarchy'
import { replaceInMap } from 'utils/map'
+import { HIERARCHY_ROOT } from 'services/aphp/serviceValueSets'
/**
* @param {Hierarchy[]} selectedNodes - Nodes selected in the hierarchy.
* @param {Codes>} fetchedCodes - All the codes that have already been fetched and saved.
@@ -28,12 +28,12 @@ export const useHierarchy = (
onCache: (codes: Codes>) => void,
fetchHandler: (ids: string, system: string) => Promise[]>
) => {
- console.log('test loop hier')
const DEFAULT_HIERARCHY_INFO = {
tree: [],
count: 0,
page: 1,
- system: ''
+ system: '',
+ selectAllStatus: SelectedStatus.INDETERMINATE
}
const [trees, setTrees] = useState