@openmrs/esm-implementer-tools-app 3.2.1-pre.1098 → 3.2.1-pre.1104
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/dist/268.js +2 -0
- package/dist/268.js.map +1 -0
- package/dist/494.js +1 -1
- package/dist/614.js +1 -1
- package/dist/614.js.map +1 -1
- package/dist/683.js +1 -1
- package/dist/683.js.map +1 -1
- package/dist/769.js +3 -0
- package/dist/769.js.LICENSE.txt +14 -0
- package/dist/769.js.map +1 -0
- package/dist/95.js +1 -1
- package/dist/openmrs-esm-implementer-tools-app.js +1 -1
- package/dist/openmrs-esm-implementer-tools-app.js.buildmanifest.json +67 -47
- package/dist/openmrs-esm-implementer-tools-app.js.map +1 -1
- package/dist/openmrs-esm-implementer-tools-app.old +1 -1
- package/package.json +5 -4
- package/src/configuration/interactive-editor/value-editors/patient-identifier-type-search.tsx +107 -0
- package/src/configuration/interactive-editor/value-editors/patient-identifier-type.resource.tsx +31 -0
- package/src/configuration/interactive-editor/value-editors/value-editor-field.tsx +6 -0
- package/dist/371.js +0 -2
- package/dist/371.js.map +0 -1
- package/dist/707.js +0 -2
- package/dist/707.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openmrs/esm-implementer-tools-app",
|
|
3
|
-
"version": "3.2.1-pre.
|
|
3
|
+
"version": "3.2.1-pre.1104",
|
|
4
4
|
"license": "MPL-2.0",
|
|
5
5
|
"description": "The admin interface for OpenMRS Frontend",
|
|
6
6
|
"browser": "dist/openmrs-esm-implementer-tools-app.js",
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"debug": "npm run serve",
|
|
13
13
|
"test": "jest --config jest.config.js --passWithNoTests",
|
|
14
14
|
"build": "webpack --mode=production",
|
|
15
|
+
"build:development": "webpack --mode=development",
|
|
15
16
|
"analyze": "webpack --mode=production --env analyze=true",
|
|
16
17
|
"typescript": "tsc",
|
|
17
18
|
"lint": "eslint src --ext ts,tsx",
|
|
@@ -51,8 +52,8 @@
|
|
|
51
52
|
"rxjs": "6.x"
|
|
52
53
|
},
|
|
53
54
|
"devDependencies": {
|
|
54
|
-
"@openmrs/esm-framework": "^3.2.1-pre.
|
|
55
|
-
"@openmrs/webpack-config": "^3.2.1-pre.
|
|
55
|
+
"@openmrs/esm-framework": "^3.2.1-pre.1104",
|
|
56
|
+
"@openmrs/webpack-config": "^3.2.1-pre.1104",
|
|
56
57
|
"@types/carbon-components-react": "^7.24.0",
|
|
57
58
|
"ace-builds": "^1.4.14",
|
|
58
59
|
"jest": "^26.6.3",
|
|
@@ -61,5 +62,5 @@
|
|
|
61
62
|
"react-dom": "^16.13.1",
|
|
62
63
|
"rxjs": "^6.5.3"
|
|
63
64
|
},
|
|
64
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "6c6f028f0195870cd70f0b3550ae5f57c59eb15a"
|
|
65
66
|
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import React, { useState, useMemo } from "react";
|
|
2
|
+
import uniqueId from "lodash-es/uniqueId";
|
|
3
|
+
import {
|
|
4
|
+
usePatientIdentifierTypes,
|
|
5
|
+
PatientIdentifierType,
|
|
6
|
+
} from "./patient-identifier-type.resource";
|
|
7
|
+
import styles from "./uuid-search.scss";
|
|
8
|
+
import { useTranslation } from "react-i18next";
|
|
9
|
+
import {
|
|
10
|
+
Search,
|
|
11
|
+
StructuredListCell,
|
|
12
|
+
StructuredListRow,
|
|
13
|
+
StructuredListWrapper,
|
|
14
|
+
} from "carbon-components-react";
|
|
15
|
+
|
|
16
|
+
interface PatientIdentifierTypeSearchBoxProps {
|
|
17
|
+
value: string;
|
|
18
|
+
setPatientIdentifierTypeUuid: (patientIdentifierTypeUuid) => void;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function PatientIdentifierTypeSearchBox({
|
|
22
|
+
setPatientIdentifierTypeUuid,
|
|
23
|
+
value,
|
|
24
|
+
}: PatientIdentifierTypeSearchBoxProps) {
|
|
25
|
+
const [searchTerm, setSearchTerm] = useState("");
|
|
26
|
+
const { data: patientIdentifierTypes, isLoading } =
|
|
27
|
+
usePatientIdentifierTypes();
|
|
28
|
+
const [activePatientIdentifierTypeUuid, setActivePatientIdentifierTypeUuid] =
|
|
29
|
+
useState<any>(value);
|
|
30
|
+
const { t } = useTranslation();
|
|
31
|
+
|
|
32
|
+
const id = useMemo(() => uniqueId(), []);
|
|
33
|
+
|
|
34
|
+
const handleUuidChange = (patientIdentifierType: PatientIdentifierType) => {
|
|
35
|
+
setActivePatientIdentifierTypeUuid(patientIdentifierType.uuid);
|
|
36
|
+
setPatientIdentifierTypeUuid(patientIdentifierType.uuid);
|
|
37
|
+
setSearchTerm("");
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const handleSearchTermChange = (evt) => setSearchTerm(evt.target.value);
|
|
41
|
+
|
|
42
|
+
const filteredResults: Array<PatientIdentifierType> | undefined =
|
|
43
|
+
useMemo(() => {
|
|
44
|
+
if (!isLoading && searchTerm && searchTerm !== "") {
|
|
45
|
+
return patientIdentifierTypes?.filter((type) =>
|
|
46
|
+
type.display.toLowerCase().includes(searchTerm.toLowerCase())
|
|
47
|
+
);
|
|
48
|
+
} else {
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
}, [isLoading, searchTerm, patientIdentifierTypes]);
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<div>
|
|
55
|
+
{activePatientIdentifierTypeUuid && (
|
|
56
|
+
<p className={styles.activeUuid}>{activePatientIdentifierTypeUuid}</p>
|
|
57
|
+
)}
|
|
58
|
+
<div className={styles.autocomplete}>
|
|
59
|
+
<Search
|
|
60
|
+
id={`search-input-${id}`}
|
|
61
|
+
labelText=""
|
|
62
|
+
type="text"
|
|
63
|
+
size="sm"
|
|
64
|
+
placeholder={
|
|
65
|
+
!isLoading
|
|
66
|
+
? t(
|
|
67
|
+
"searchPersonAttributeHelperText",
|
|
68
|
+
"Person attribute type name"
|
|
69
|
+
)
|
|
70
|
+
: t("loading", "Loading")
|
|
71
|
+
}
|
|
72
|
+
onChange={handleSearchTermChange}
|
|
73
|
+
value={searchTerm}
|
|
74
|
+
disabled={isLoading}
|
|
75
|
+
/>
|
|
76
|
+
{searchTerm ? (
|
|
77
|
+
filteredResults?.length ? (
|
|
78
|
+
<StructuredListWrapper
|
|
79
|
+
selection
|
|
80
|
+
className={styles.listbox}
|
|
81
|
+
id={`searchbox-${id}`}
|
|
82
|
+
>
|
|
83
|
+
{filteredResults?.map((patientIdentifierType) => (
|
|
84
|
+
<StructuredListRow
|
|
85
|
+
key={patientIdentifierType.uuid}
|
|
86
|
+
role="option"
|
|
87
|
+
onClick={() => {
|
|
88
|
+
handleUuidChange(patientIdentifierType);
|
|
89
|
+
}}
|
|
90
|
+
aria-selected="true"
|
|
91
|
+
>
|
|
92
|
+
<StructuredListCell className={styles.smallListCell}>
|
|
93
|
+
{patientIdentifierType.display}
|
|
94
|
+
</StructuredListCell>
|
|
95
|
+
</StructuredListRow>
|
|
96
|
+
))}
|
|
97
|
+
</StructuredListWrapper>
|
|
98
|
+
) : (
|
|
99
|
+
<p className={styles.bodyShort01}>
|
|
100
|
+
{t("noPersonAttributeFoundText", "No matching results found")}
|
|
101
|
+
</p>
|
|
102
|
+
)
|
|
103
|
+
) : null}
|
|
104
|
+
</div>
|
|
105
|
+
</div>
|
|
106
|
+
);
|
|
107
|
+
}
|
package/src/configuration/interactive-editor/value-editors/patient-identifier-type.resource.tsx
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import useSWR from "swr";
|
|
2
|
+
import { FetchResponse, openmrsFetch } from "@openmrs/esm-framework";
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
|
|
5
|
+
export interface PatientIdentifierType {
|
|
6
|
+
uuid: string;
|
|
7
|
+
display: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface PatientIdentifierTypeResponse {
|
|
11
|
+
results: Array<PatientIdentifierType>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function usePatientIdentifierTypes(): {
|
|
15
|
+
data: Array<PatientIdentifierType> | undefined;
|
|
16
|
+
isLoading: boolean;
|
|
17
|
+
} {
|
|
18
|
+
const { data, error } = useSWR<
|
|
19
|
+
FetchResponse<PatientIdentifierTypeResponse>,
|
|
20
|
+
Error
|
|
21
|
+
>(`/ws/rest/v1/patientidentifiertype`, openmrsFetch);
|
|
22
|
+
const memoisedPatientIdentifierTypeData = useMemo(
|
|
23
|
+
() => ({
|
|
24
|
+
data: data?.data?.results,
|
|
25
|
+
isLoading: !data && !error,
|
|
26
|
+
}),
|
|
27
|
+
[data, error]
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
return memoisedPatientIdentifierTypeData;
|
|
31
|
+
}
|
|
@@ -11,6 +11,7 @@ import { ExtensionSlotRemove } from "./extension-slot-remove";
|
|
|
11
11
|
import { ObjectEditor } from "./object-editor";
|
|
12
12
|
import { ExtensionSlotOrder } from "./extension-slot-order";
|
|
13
13
|
import { PersonAttributeTypeSearchBox } from "./person-attribute-search";
|
|
14
|
+
import { PatientIdentifierTypeSearchBox } from "./patient-identifier-type-search";
|
|
14
15
|
|
|
15
16
|
export interface ValueEditorFieldProps {
|
|
16
17
|
element: ConfigValueDescriptor;
|
|
@@ -57,6 +58,11 @@ export function ValueEditorField({
|
|
|
57
58
|
onChange(personAttributeTypeUuid)
|
|
58
59
|
}
|
|
59
60
|
/>
|
|
61
|
+
) : valueType === Type.PatientIdentifierTypeUuid ? (
|
|
62
|
+
<PatientIdentifierTypeSearchBox
|
|
63
|
+
value={value}
|
|
64
|
+
setPatientIdentifierTypeUuid={(uuid) => onChange(uuid)}
|
|
65
|
+
/>
|
|
60
66
|
) : valueType === Type.Number ? (
|
|
61
67
|
<NumberInput
|
|
62
68
|
id={id}
|