@openmrs/esm-form-engine-lib 2.1.0-pre.1367 → 2.1.0-pre.1369
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
@@ -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
|
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|