@openmrs/esm-form-engine-lib 2.1.0-pre.1367 → 2.1.0-pre.1373
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/package.json +1 -1
- package/src/components/inputs/multi-select/multi-select.component.tsx +15 -13
- package/src/form-engine.component.tsx +6 -4
- package/src/provider/form-factory-provider.tsx +0 -1
- package/translations/en.json +8 -15
- package/5437df60cc8c64ae/5437df60cc8c64ae.gz +0 -0
- package/54642294e8d8bce2/54642294e8d8bce2.gz +0 -0
- package/e590909e6a126db8/e590909e6a126db8.gz +0 -0
- package/fd02e35beec231cc/fd02e35beec231cc.gz +0 -0
package/package.json
CHANGED
@@ -130,19 +130,21 @@ const MultiSelect: React.FC<FormFieldInputProps> = ({ field, value, errors, warn
|
|
130
130
|
)}
|
131
131
|
</Layer>
|
132
132
|
</div>
|
133
|
-
|
134
|
-
{
|
135
|
-
|
136
|
-
{
|
137
|
-
|
138
|
-
{
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
133
|
+
{!field.inlineMultiCheckbox && (
|
134
|
+
<div className={styles.selectionDisplay}>
|
135
|
+
{value?.length ? (
|
136
|
+
<div className={styles.tagContainer}>
|
137
|
+
{formFieldAdapters[field.type]?.getDisplayValue(field, value)?.map((displayValue, index) => (
|
138
|
+
<Tag key={index} type="cool-gray">
|
139
|
+
{displayValue}
|
140
|
+
</Tag>
|
141
|
+
))}
|
142
|
+
</div>
|
143
|
+
) : (
|
144
|
+
<ValueEmpty />
|
145
|
+
)}
|
146
|
+
</div>
|
147
|
+
)}
|
146
148
|
</>
|
147
149
|
)
|
148
150
|
);
|
@@ -3,7 +3,6 @@ import type { FormField, SessionMode, FormSchema } from './types';
|
|
3
3
|
import { useSession, type Visit } from '@openmrs/esm-framework';
|
4
4
|
import { useFormJson } from '.';
|
5
5
|
import FormProcessorFactory from './components/processor-factory/form-processor-factory.component';
|
6
|
-
import { Form } from '@carbon/react';
|
7
6
|
import Loader from './components/loaders/loader.component';
|
8
7
|
import { usePatientData } from './hooks/usePatientData';
|
9
8
|
import { useWorkspaceLayout } from './hooks/useWorkspaceLayout';
|
@@ -66,13 +65,16 @@ const FormEngine = ({
|
|
66
65
|
// TODO: Updating this prop triggers a rerender of the entire form. This means whenever we scroll into a new page, the form is rerendered.
|
67
66
|
// Figure out a way to avoid this. Maybe use a ref with an observer instead of a state?
|
68
67
|
const [currentPage, setCurrentPage] = useState('');
|
69
|
-
const [showPatientBanner, setShowPatientBanner] = useState(false);
|
70
68
|
const {
|
71
69
|
formJson: refinedFormJson,
|
72
70
|
isLoading: isLoadingFormJson,
|
73
71
|
formError,
|
74
72
|
} = useFormJson(formUUID, formJson, encounterUUID, formSessionIntent);
|
75
73
|
|
74
|
+
const showPatientBanner = useMemo(() => {
|
75
|
+
return patient && workspaceLayout !== 'minimized' && mode !== 'embedded-view';
|
76
|
+
}, [patient, mode, workspaceLayout]);
|
77
|
+
|
76
78
|
const showButtonSet = useMemo(() => {
|
77
79
|
// if (mode === 'embedded-view') {
|
78
80
|
// return false;
|
@@ -102,7 +104,7 @@ const FormEngine = ({
|
|
102
104
|
}, []);
|
103
105
|
|
104
106
|
return (
|
105
|
-
<
|
107
|
+
<form ref={ref} noValidate className={classNames('cds--form', styles.form)} onSubmit={handleSubmit}>
|
106
108
|
{isLoadingPatient || isLoadingFormJson ? (
|
107
109
|
<Loader />
|
108
110
|
) : (
|
@@ -171,7 +173,7 @@ const FormEngine = ({
|
|
171
173
|
</div>
|
172
174
|
</FormFactoryProvider>
|
173
175
|
)}
|
174
|
-
</
|
176
|
+
</form>
|
175
177
|
);
|
176
178
|
};
|
177
179
|
|
@@ -14,7 +14,6 @@ import { type FormContextProps } from './form-provider';
|
|
14
14
|
import { processPostSubmissionActions, validateForm } from './form-factory-helper';
|
15
15
|
import { useTranslation } from 'react-i18next';
|
16
16
|
import { usePostSubmissionActions } from '../hooks/usePostSubmissionActions';
|
17
|
-
import { reportError } from '../utils/error-utils';
|
18
17
|
|
19
18
|
interface FormFactoryProviderContextProps {
|
20
19
|
patient: fhir.Patient;
|
package/translations/en.json
CHANGED
@@ -2,22 +2,17 @@
|
|
2
2
|
"add": "Add",
|
3
3
|
"addCameraImage": "Add camera image",
|
4
4
|
"addFile": "Add files",
|
5
|
-
"attachmentsSaved": "Attachment(s) saved successfully",
|
6
5
|
"cameraCapture": "Camera capture",
|
7
6
|
"cancel": "Cancel",
|
8
7
|
"chooseAnOption": "Choose an option",
|
8
|
+
"clearFile": "Clear file",
|
9
9
|
"close": "Close",
|
10
10
|
"closeCamera": "Close camera",
|
11
11
|
"closesNotification": "Closes notification",
|
12
|
-
"
|
13
|
-
"
|
14
|
-
"errorDescription": "{{errors}}",
|
15
|
-
"errorDescriptionTitle": "Error on saving form",
|
12
|
+
"errorLoadingFormSchema": "Error loading form schema",
|
13
|
+
"errorLoadingInitialValues": "Error loading initial values",
|
16
14
|
"errorRenderingField": "Error rendering field",
|
17
|
-
"
|
18
|
-
"errorSavingEncounter": "Error saving encounter",
|
19
|
-
"errorSavingPatientIdentifiers": "Error saving patient identifiers",
|
20
|
-
"errorSavingPatientPrograms": "Error saving patient program(s)",
|
15
|
+
"fieldErrorDescriptionTitle": "Validation Errors",
|
21
16
|
"fileUploadDescription": "",
|
22
17
|
"fileUploadDescriptionAny": "Upload any file type",
|
23
18
|
"invalidWorkspaceName": "Invalid workspace name.",
|
@@ -25,13 +20,12 @@
|
|
25
20
|
"launchWorkspace": "",
|
26
21
|
"loading": "Loading",
|
27
22
|
"notification": "Notification",
|
28
|
-
"
|
29
|
-
"patientIdentifiersSaved": "Patient identifier(s) saved sucessfully",
|
30
|
-
"patientProgramsSaved": "Patient program(s) saved successfully",
|
23
|
+
"nullMandatoryField": "Please fill the required fields",
|
31
24
|
"preview": "Preview",
|
32
25
|
"previousValue": "Previous value:",
|
33
26
|
"remove": "Remove",
|
34
27
|
"required": "Required",
|
28
|
+
"reuseValue": "Reuse value",
|
35
29
|
"revert": "Revert",
|
36
30
|
"save": "Save",
|
37
31
|
"search": "Search",
|
@@ -39,9 +33,8 @@
|
|
39
33
|
"time": "Time",
|
40
34
|
"unspecified": "Unspecified",
|
41
35
|
"unspecifyAll": "Unspecify All",
|
42
|
-
"updatedRecord": "Record updated",
|
43
|
-
"updatedRecordDescription": "The patient encounter was updated",
|
44
36
|
"upload": "Upload",
|
45
37
|
"uploadedPhoto": "Uploaded photo",
|
46
|
-
"uploadImage": "Upload image"
|
38
|
+
"uploadImage": "Upload image",
|
39
|
+
"valuesOutOfBound": "Some of the values are out of bounds"
|
47
40
|
}
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|