From 0fbbc6ee241363d8c9b84c3bc75da20169b51a68 Mon Sep 17 00:00:00 2001 From: CynthiaKamau Date: Thu, 25 Apr 2024 10:23:01 +0300 Subject: [PATCH] (chore) O3-3114: Bump react form engine (#1839) --- packages/esm-commons-lib/package.json | 2 +- .../encounter-list.component.tsx | 8 +-- .../encounter-list/encounter-list.test.tsx | 2 +- .../src/components/encounter-list/helpers.ts | 4 +- .../ohri-form-empty-launcher.component.tsx | 2 +- .../ohri-form-launcher.component.tsx | 2 +- .../src/utils/ohri-forms-commons.ts | 4 +- .../src/workspace/ohri-workspace-utils.ts | 4 +- packages/esm-form-render-app/package.json | 2 +- .../render/forms-render-test.component.tsx | 6 +- yarn.lock | 68 ++++++++----------- 11 files changed, 46 insertions(+), 58 deletions(-) diff --git a/packages/esm-commons-lib/package.json b/packages/esm-commons-lib/package.json index 2a09b91c8..d798b6b0d 100644 --- a/packages/esm-commons-lib/package.json +++ b/packages/esm-commons-lib/package.json @@ -32,7 +32,7 @@ }, "dependencies": { "@carbon/react": "^1.13.0", - "@openmrs/openmrs-form-engine-lib": "1.0.0-pre.589", + "@openmrs/openmrs-form-engine-lib": "1.1.0-pre.723", "fuzzy": "^0.1.3", "lodash-es": "^4.17.15", "systemjs-webpack-interop": "^2.3.7", diff --git a/packages/esm-commons-lib/src/components/encounter-list/encounter-list.component.tsx b/packages/esm-commons-lib/src/components/encounter-list/encounter-list.component.tsx index f5e089bd1..d56efb409 100644 --- a/packages/esm-commons-lib/src/components/encounter-list/encounter-list.component.tsx +++ b/packages/esm-commons-lib/src/components/encounter-list/encounter-list.component.tsx @@ -2,12 +2,12 @@ import { navigate } from '@openmrs/esm-framework'; import React, { useCallback, useEffect, useMemo, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { EmptyState } from '../empty-state/empty-state.component'; -import { OHRIFormLauncherWithIntent } from '../ohri-form-launcher/ohri-form-launcher.component'; +import { FormLauncherWithIntent } from '../ohri-form-launcher/ohri-form-launcher.component'; import styles from './encounter-list.scss'; import { OTable } from '../data-table/o-table.component'; import { Button, Link, OverflowMenu, OverflowMenuItem, Pagination, DataTableSkeleton } from '@carbon/react'; import { Add } from '@carbon/react/icons'; -import { OHRIFormSchema } from '@openmrs/openmrs-form-engine-lib'; +import { FormSchema } from '@openmrs/openmrs-form-engine-lib'; import { launchEncounterForm } from './helpers'; import { useEncounterRows } from '../../hooks/useEncounterRows'; import { OpenmrsEncounter } from '../../api/types'; @@ -55,7 +55,7 @@ export const EncounterList: React.FC = ({ }) => { const { t } = useTranslation(); const [paginatedRows, setPaginatedRows] = useState([]); - const [forms, setForms] = useState([]); + const [forms, setForms] = useState([]); const [currentPage, setCurrentPage] = useState(1); const [pageSize, setPageSize] = useState(10); const [isLoadingForms, setIsLoadingForms] = useState(true); @@ -244,7 +244,7 @@ export const EncounterList: React.FC = ({ ); } else if (forms.length && !(hideFormLauncher ?? isDead)) { return ( - launchEncounterForm( diff --git a/packages/esm-commons-lib/src/components/encounter-list/encounter-list.test.tsx b/packages/esm-commons-lib/src/components/encounter-list/encounter-list.test.tsx index c94efe220..6c776c1c7 100644 --- a/packages/esm-commons-lib/src/components/encounter-list/encounter-list.test.tsx +++ b/packages/esm-commons-lib/src/components/encounter-list/encounter-list.test.tsx @@ -48,7 +48,7 @@ jest.mock('@openmrs/esm-patient-common-lib', () => ({ })); jest.mock('@openmrs/openmrs-form-engine-lib', () => ({ - OHRIForm: jest + FormEngine: jest .fn() .mockImplementation(() => React.createElement('div', { 'data-testid': 'openmrs form' }, 'FORM ENGINE LIB')), })); diff --git a/packages/esm-commons-lib/src/components/encounter-list/helpers.ts b/packages/esm-commons-lib/src/components/encounter-list/helpers.ts index 41dd37736..503970db1 100644 --- a/packages/esm-commons-lib/src/components/encounter-list/helpers.ts +++ b/packages/esm-commons-lib/src/components/encounter-list/helpers.ts @@ -1,10 +1,10 @@ import { launchPatientWorkspace } from '@openmrs/esm-patient-common-lib'; -import { OHRIFormSchema } from '@openmrs/openmrs-form-engine-lib'; +import { FormSchema } from '@openmrs/openmrs-form-engine-lib'; type LaunchAction = 'add' | 'view' | 'edit' | 'embedded-view'; export function launchEncounterForm( - form: OHRIFormSchema, + form: FormSchema, moduleName: string, action: LaunchAction = 'add', onFormSave: () => void, diff --git a/packages/esm-commons-lib/src/components/ohri-form-launcher/ohri-form-empty-launcher.component.tsx b/packages/esm-commons-lib/src/components/ohri-form-launcher/ohri-form-empty-launcher.component.tsx index 185f5def3..1ac693f2c 100644 --- a/packages/esm-commons-lib/src/components/ohri-form-launcher/ohri-form-empty-launcher.component.tsx +++ b/packages/esm-commons-lib/src/components/ohri-form-launcher/ohri-form-empty-launcher.component.tsx @@ -3,7 +3,7 @@ import { Button } from '@carbon/react'; import { Add } from '@carbon/react/icons'; import { useTranslation } from 'react-i18next'; -export const OHRIFormLauncherEmpty: React.FC<{ +export const FormLauncherEmpty: React.FC<{ launchForm: (formJson?: any) => void; }> = ({ launchForm }) => { const { t } = useTranslation(); diff --git a/packages/esm-commons-lib/src/components/ohri-form-launcher/ohri-form-launcher.component.tsx b/packages/esm-commons-lib/src/components/ohri-form-launcher/ohri-form-launcher.component.tsx index 29208a2f0..0bb844250 100644 --- a/packages/esm-commons-lib/src/components/ohri-form-launcher/ohri-form-launcher.component.tsx +++ b/packages/esm-commons-lib/src/components/ohri-form-launcher/ohri-form-launcher.component.tsx @@ -4,7 +4,7 @@ import styles from './launcher-with-intent.scss'; import { useTranslation } from 'react-i18next'; import { OHRIOverflowMenu } from '../overflow-menu-button/ohri-overflow-menu.component'; -export const OHRIFormLauncherWithIntent: React.FC<{ +export const FormLauncherWithIntent: React.FC<{ launchForm: (formJson?: any, intent?: string) => void; title?: string; formJsonList?: Array; diff --git a/packages/esm-commons-lib/src/utils/ohri-forms-commons.ts b/packages/esm-commons-lib/src/utils/ohri-forms-commons.ts index 33efde274..c407722c0 100644 --- a/packages/esm-commons-lib/src/utils/ohri-forms-commons.ts +++ b/packages/esm-commons-lib/src/utils/ohri-forms-commons.ts @@ -1,8 +1,8 @@ -import { OHRIFormSchema, SessionMode } from '@openmrs/openmrs-form-engine-lib'; +import { FormSchema, SessionMode } from '@openmrs/openmrs-form-engine-lib'; import { launchOHRIWorkSpace } from '../workspace/ohri-workspace-utils'; export const launchForm = ( - form: OHRIFormSchema, + form: FormSchema, mode: SessionMode = 'enter', moduleName: string, title?: string, diff --git a/packages/esm-commons-lib/src/workspace/ohri-workspace-utils.ts b/packages/esm-commons-lib/src/workspace/ohri-workspace-utils.ts index 826eb323a..53bd3f150 100644 --- a/packages/esm-commons-lib/src/workspace/ohri-workspace-utils.ts +++ b/packages/esm-commons-lib/src/workspace/ohri-workspace-utils.ts @@ -1,7 +1,7 @@ import { getSyncLifecycle } from '@openmrs/esm-framework'; import { BehaviorSubject } from 'rxjs'; import { closeWorkspace, launchPatientWorkspace, registerWorkspace } from '@openmrs/esm-patient-common-lib'; -import { OHRIForm, SessionMode } from '@openmrs/openmrs-form-engine-lib'; +import { FormEngine, SessionMode } from '@openmrs/openmrs-form-engine-lib'; export interface WorkspaceContextProps { title: string; encounterUuid?: string; @@ -30,7 +30,7 @@ export const launchOHRIWorkSpace = (props: WorkspaceContextProps) => { name: workspaceName, title: props.title, preferredWindowSize: props.screenSize, - load: getSyncLifecycle(OHRIForm, { + load: getSyncLifecycle(FormEngine, { featureName: 'ohri-forms-workspace-item', moduleName: props.moduleName, }), diff --git a/packages/esm-form-render-app/package.json b/packages/esm-form-render-app/package.json index 9e4d9c92d..1b2ba25f5 100644 --- a/packages/esm-form-render-app/package.json +++ b/packages/esm-form-render-app/package.json @@ -39,7 +39,7 @@ }, "dependencies": { "@carbon/react": "^1.13.0", - "@openmrs/openmrs-form-engine-lib": "1.0.0-pre.589", + "@openmrs/openmrs-form-engine-lib": "1.1.0-pre.723", "ace-builds": "^1.4.12", "react-ace": "^9.4.4" }, diff --git a/packages/esm-form-render-app/src/render/forms-render-test.component.tsx b/packages/esm-form-render-app/src/render/forms-render-test.component.tsx index bd35e63a9..1fc3442ba 100644 --- a/packages/esm-form-render-app/src/render/forms-render-test.component.tsx +++ b/packages/esm-form-render-app/src/render/forms-render-test.component.tsx @@ -4,7 +4,7 @@ import styles from './form-render.scss'; import { Run, Maximize, UserData } from '@carbon/react/icons'; import AceEditor from 'react-ace'; import 'ace-builds/webpack-resolver'; -import { applyFormIntent, loadSubforms, OHRIForm, OHRIFormSchema } from '@openmrs/openmrs-form-engine-lib'; +import { applyFormIntent, loadSubforms, FormEngine, FormSchema } from '@openmrs/openmrs-form-engine-lib'; import { useTranslation } from 'react-i18next'; import { ConfigObject, useConfig, openmrsFetch } from '@openmrs/esm-framework'; import { handleFormValidation } from '../form-validator'; @@ -13,7 +13,7 @@ function FormRenderTest() { const { t } = useTranslation(); const headerTitle = t('formRenderTestTitle', 'Form Render Test'); const { patientUuid, dataTypeToRenderingMap } = useConfig() as ConfigObject; - const [formInput, setFormInput] = useState(); + const [formInput, setFormInput] = useState(); const [formIntents, setFormIntents] = useState([]); const [isIntentsDropdownDisabled, setIsIntentsDropdownDisabled] = useState(true); const [selectedFormIntent, setSelectedFormIntent] = useState(''); @@ -267,7 +267,7 @@ function FormRenderTest() { {isSchemaLoaded ? (
-