@openmrs/esm-implementer-tools-app 8.0.1-pre.3459 → 8.0.1-pre.3473
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +1 -1
- package/dist/6132.js +1 -1
- package/dist/6132.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/openmrs-esm-implementer-tools-app.js +1 -1
- package/dist/openmrs-esm-implementer-tools-app.js.buildmanifest.json +5 -5
- package/dist/routes.json +1 -1
- package/package.json +3 -3
- package/src/configuration/configuration.test.tsx +35 -5
- package/src/configuration/interactive-editor/config-subtree.component.tsx +27 -24
- package/src/configuration/interactive-editor/editable-value.component.tsx +3 -1
- package/src/configuration/interactive-editor/value-editors/concept-search.tsx +3 -4
|
@@ -10,20 +10,21 @@ export interface ConfigSubtreeProps {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export function ConfigSubtree({ config, path = [] }: ConfigSubtreeProps) {
|
|
13
|
-
function setActiveItemDescriptionOnMouseEnter(thisPath
|
|
13
|
+
function setActiveItemDescriptionOnMouseEnter(thisPath: Array<string>, value: any) {
|
|
14
14
|
if (!implementerToolsStore.getState().configPathBeingEdited) {
|
|
15
|
+
const isLeaf = value && typeof value === 'object' && Object.hasOwn(value, '_value');
|
|
15
16
|
implementerToolsStore.setState({
|
|
16
17
|
activeItemDescription: {
|
|
17
18
|
path: thisPath,
|
|
18
|
-
source: value._source,
|
|
19
|
-
description: value._description,
|
|
20
|
-
value: JSON.stringify(value._value),
|
|
19
|
+
source: isLeaf ? value._source : undefined,
|
|
20
|
+
description: isLeaf ? value._description : undefined,
|
|
21
|
+
value: isLeaf ? JSON.stringify(value._value) : undefined,
|
|
21
22
|
},
|
|
22
23
|
});
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
26
|
|
|
26
|
-
function removeActiveItemDescriptionOnMouseLeave(thisPath) {
|
|
27
|
+
function removeActiveItemDescriptionOnMouseLeave(thisPath: Array<string>) {
|
|
27
28
|
const state = implementerToolsStore.getState();
|
|
28
29
|
if (isEqual(state.activeItemDescription?.path, thisPath) && !isEqual(state.configPathBeingEdited, thisPath)) {
|
|
29
30
|
implementerToolsStore.setState({ activeItemDescription: undefined });
|
|
@@ -32,25 +33,27 @@ export function ConfigSubtree({ config, path = [] }: ConfigSubtreeProps) {
|
|
|
32
33
|
|
|
33
34
|
return (
|
|
34
35
|
<>
|
|
35
|
-
{Object.entries(config)
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
36
|
+
{Object.entries(config)
|
|
37
|
+
.filter(([key]) => !key.startsWith('_'))
|
|
38
|
+
.map(([key, value]) => {
|
|
39
|
+
const thisPath = path.concat([key]);
|
|
40
|
+
const isLeaf = value && typeof value === 'object' && Object.hasOwn(value, '_value');
|
|
41
|
+
return (
|
|
42
|
+
<Subtree
|
|
43
|
+
label={key}
|
|
44
|
+
leaf={isLeaf}
|
|
45
|
+
onMouseEnter={() => setActiveItemDescriptionOnMouseEnter(thisPath, value)}
|
|
46
|
+
onMouseLeave={() => removeActiveItemDescriptionOnMouseLeave(thisPath)}
|
|
47
|
+
key={`subtree-${thisPath.join('.')}`}
|
|
48
|
+
>
|
|
49
|
+
{isLeaf ? (
|
|
50
|
+
<EditableValue path={thisPath} element={value} />
|
|
51
|
+
) : (
|
|
52
|
+
<ConfigSubtree config={value} path={thisPath} />
|
|
53
|
+
)}
|
|
54
|
+
</Subtree>
|
|
55
|
+
);
|
|
56
|
+
})}
|
|
54
57
|
</>
|
|
55
58
|
);
|
|
56
59
|
}
|
|
@@ -125,7 +125,9 @@ export default function EditableValue({ path, element, customType }: EditableVal
|
|
|
125
125
|
hasIconOnly
|
|
126
126
|
onClick={() => {
|
|
127
127
|
clearConfigErrors(path.join('.'));
|
|
128
|
-
|
|
128
|
+
const state = cloneDeep(temporaryConfigStore.getState());
|
|
129
|
+
unset(state, ['config', ...path]);
|
|
130
|
+
temporaryConfigStore.setState(state);
|
|
129
131
|
}}
|
|
130
132
|
/>
|
|
131
133
|
) : null}
|
|
@@ -14,7 +14,7 @@ import { useConceptLookup } from './concept-search.resource';
|
|
|
14
14
|
import styles from './uuid-search.scss';
|
|
15
15
|
|
|
16
16
|
interface ConceptSearchBoxProps {
|
|
17
|
-
setConcept: (concept) => void;
|
|
17
|
+
setConcept: (concept: Concept) => void;
|
|
18
18
|
value: string;
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -25,11 +25,11 @@ export function ConceptSearchBox({ setConcept, value }: ConceptSearchBoxProps) {
|
|
|
25
25
|
const [selectedConcept, setSelectedConcept] = useState<string>(value);
|
|
26
26
|
const { concepts, isSearchingConcepts } = useConceptLookup(conceptToLookup);
|
|
27
27
|
|
|
28
|
-
const handleSearchTermChange = (event) => {
|
|
28
|
+
const handleSearchTermChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
29
29
|
setConceptToLookup(event.target.value);
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
-
const handleConceptUuidChange = (concept) => {
|
|
32
|
+
const handleConceptUuidChange = (concept: Concept) => {
|
|
33
33
|
setSelectedConcept(concept.uuid);
|
|
34
34
|
setConcept(concept);
|
|
35
35
|
setConceptToLookup('');
|
|
@@ -47,7 +47,6 @@ export function ConceptSearchBox({ setConcept, value }: ConceptSearchBoxProps) {
|
|
|
47
47
|
autoComplete="off"
|
|
48
48
|
autoCapitalize="off"
|
|
49
49
|
aria-autocomplete="list"
|
|
50
|
-
role="combobox"
|
|
51
50
|
aria-label={t('searchConceptHelperText', 'Search concepts')}
|
|
52
51
|
aria-controls={`searchbox-${id}`}
|
|
53
52
|
aria-expanded={concepts.length > 0}
|