@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-form-engine-lib",
3
- "version": "2.1.0-pre.1367",
3
+ "version": "2.1.0-pre.1373",
4
4
  "description": "React Form Engine for O3",
5
5
  "browser": "dist/openmrs-esm-form-engine-lib.js",
6
6
  "main": "src/index.ts",
@@ -130,19 +130,21 @@ const MultiSelect: React.FC<FormFieldInputProps> = ({ field, value, errors, warn
130
130
  )}
131
131
  </Layer>
132
132
  </div>
133
- <div className={styles.selectionDisplay}>
134
- {value?.length && field.questionOptions.answers?.length > 5 ? (
135
- <div className={styles.tagContainer}>
136
- {formFieldAdapters[field.type]?.getDisplayValue(field, value)?.map((displayValue, index) => (
137
- <Tag key={index} type="cool-gray">
138
- {displayValue}
139
- </Tag>
140
- ))}
141
- </div>
142
- ) : (
143
- <ValueEmpty />
144
- )}
145
- </div>
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
- <Form noValidate ref={ref} className={classNames('cds--form', styles.form)} onSubmit={handleSubmit}>
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
- </Form>
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;
@@ -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
- "submittedForm": "Form submitted",
13
- "submittedFormDescription": "Form submitted successfully",
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
- "errorSavingAttachments": "Error saving attachment(s)",
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
- "ordersSaved": "Order(s) saved sucessfully",
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
  }