Skip to content

Commit

Permalink
(chore) O3-3114: Bump react form engine (#1839)
Browse files Browse the repository at this point in the history
  • Loading branch information
CynthiaKamau authored Apr 25, 2024
1 parent 4bff3ea commit 0fbbc6e
Show file tree
Hide file tree
Showing 11 changed files with 46 additions and 58 deletions.
2 changes: 1 addition & 1 deletion packages/esm-commons-lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -55,7 +55,7 @@ export const EncounterList: React.FC<EncounterListProps> = ({
}) => {
const { t } = useTranslation();
const [paginatedRows, setPaginatedRows] = useState([]);
const [forms, setForms] = useState<OHRIFormSchema[]>([]);
const [forms, setForms] = useState<FormSchema[]>([]);
const [currentPage, setCurrentPage] = useState(1);
const [pageSize, setPageSize] = useState(10);
const [isLoadingForms, setIsLoadingForms] = useState(true);
Expand Down Expand Up @@ -244,7 +244,7 @@ export const EncounterList: React.FC<EncounterListProps> = ({
);
} else if (forms.length && !(hideFormLauncher ?? isDead)) {
return (
<OHRIFormLauncherWithIntent
<FormLauncherWithIntent
formJsonList={forms}
launchForm={(formJson, intent) =>
launchEncounterForm(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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')),
}));
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<any>;
Expand Down
4 changes: 2 additions & 2 deletions packages/esm-commons-lib/src/utils/ohri-forms-commons.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -30,7 +30,7 @@ export const launchOHRIWorkSpace = (props: WorkspaceContextProps) => {
name: workspaceName,
title: props.title,
preferredWindowSize: <any>props.screenSize,
load: getSyncLifecycle(OHRIForm, {
load: getSyncLifecycle(FormEngine, {
featureName: 'ohri-forms-workspace-item',
moduleName: props.moduleName,
}),
Expand Down
2 changes: 1 addition & 1 deletion packages/esm-form-render-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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<OHRIFormSchema>();
const [formInput, setFormInput] = useState<FormSchema>();
const [formIntents, setFormIntents] = useState([]);
const [isIntentsDropdownDisabled, setIsIntentsDropdownDisabled] = useState(true);
const [selectedFormIntent, setSelectedFormIntent] = useState('');
Expand Down Expand Up @@ -267,7 +267,7 @@ function FormRenderTest() {
<TabPanel className={styles.renderTab}>
{isSchemaLoaded ? (
<div className={styles.formRenderDisplay}>
<OHRIForm
<FormEngine
formJson={formInput}
patientUUID={patientUuid}
mode={encounterUuid ? 'edit' : 'enter'}
Expand Down
68 changes: 28 additions & 40 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2765,7 +2765,7 @@ __metadata:
resolution: "@ohri/openmrs-esm-ohri-commons-lib@workspace:packages/esm-commons-lib"
dependencies:
"@carbon/react": "npm:^1.13.0"
"@openmrs/openmrs-form-engine-lib": "npm:1.0.0-pre.589"
"@openmrs/openmrs-form-engine-lib": "npm:1.1.0-pre.723"
enzyme: "npm:^3.11.0"
enzyme-adapter-react-16: "npm:^1.15.6"
fuzzy: "npm:^0.1.3"
Expand Down Expand Up @@ -2822,7 +2822,7 @@ __metadata:
resolution: "@ohri/openmrs-esm-ohri-form-render-app@workspace:packages/esm-form-render-app"
dependencies:
"@carbon/react": "npm:^1.13.0"
"@openmrs/openmrs-form-engine-lib": "npm:1.0.0-pre.589"
"@openmrs/openmrs-form-engine-lib": "npm:1.1.0-pre.723"
ace-builds: "npm:^1.4.12"
react-ace: "npm:^9.4.4"
webpack: "npm:^5.88.2"
Expand Down Expand Up @@ -3248,30 +3248,31 @@ __metadata:
languageName: node
linkType: hard

"@openmrs/openmrs-form-engine-lib@npm:1.0.0-pre.589":
version: 1.0.0-pre.589
resolution: "@openmrs/openmrs-form-engine-lib@npm:1.0.0-pre.589"
"@openmrs/openmrs-form-engine-lib@npm:1.1.0-pre.723":
version: 1.1.0-pre.723
resolution: "@openmrs/openmrs-form-engine-lib@npm:1.1.0-pre.723"
dependencies:
ace-builds: "npm:^1.4.12"
classnames: "npm:^2.5.1"
dayjs: "npm:1.x"
formik: "npm:^2.2.6"
jest-coverage-badges: "npm:^1.0.0"
lodash-es: "npm:^4.17.15"
react-anchor-link-smooth-scroll: "npm:^1.0.12"
react-error-boundary: "npm:^4.0.11"
react-markdown: "npm:^7.1.0"
react-scroll: "npm:^1.8.2"
react-test-renderer: "npm:^16.9.0"
react-waypoint: "npm:^10.3.0"
react-webcam: "npm:^7.1.1"
semver: "npm:^7.3.5"
yup: "npm:^0.29.1"
peerDependencies:
"@carbon/react": 1.x
"@openmrs/esm-framework": 5.x
"@openmrs/esm-patient-common-lib": 7.x
dayjs: 1.x
i18next: 23.x
react: 18.x
react-i18next: 11.x
rxjs: 6.x
checksum: 37bef80c99aa250dd78881b18057fa05d08c0c2e657b33787216cf3d00ef95e23355f3a0f20539bf526afdc5a596e5007713f707fde4fd6e1e01cf7ba6f3f51b
swr: 2.x
checksum: 015d04dd06626191a084f9fefad0113f2ecbf16f0a8b46fadc4301458785978264c49350ecd9faa4bcfe78c9f723d5241a76b708d3943c53bbea3a5cf1c4cf78
languageName: node
linkType: hard

Expand Down Expand Up @@ -6802,6 +6803,13 @@ __metadata:
languageName: node
linkType: hard

"classnames@npm:^2.5.1":
version: 2.5.1
resolution: "classnames@npm:2.5.1"
checksum: 58eb394e8817021b153bb6e7d782cfb667e4ab390cb2e9dac2fc7c6b979d1cc2b2a733093955fc5c94aa79ef5c8c89f11ab77780894509be6afbb91dddd79d15
languageName: node
linkType: hard

"clean-css@npm:^5.2.2":
version: 5.3.1
resolution: "clean-css@npm:5.3.1"
Expand Down Expand Up @@ -8008,20 +8016,20 @@ __metadata:
languageName: node
linkType: hard

"dayjs@npm:1.x, dayjs@npm:^1.11.10":
version: 1.11.10
resolution: "dayjs@npm:1.11.10"
checksum: 27e8f5bc01c0a76f36c656e62ab7f08c2e7b040b09e613cd4844abf03fb258e0350f0a83b02c887b84d771c1f11e092deda0beef8c6df2a1afbc3f6c1fade279
languageName: node
linkType: hard

"dayjs@npm:^1.10.4, dayjs@npm:^1.10.7":
version: 1.11.6
resolution: "dayjs@npm:1.11.6"
checksum: 95d6ae5043aae52790fc77b6bef8255cfea2462161d9b7f0f0f866b18fed3feb9e659e6869d537bbb8cc21c839419ab93995399e20e22624f46e28b7f46245b1
languageName: node
linkType: hard

"dayjs@npm:^1.11.10":
version: 1.11.10
resolution: "dayjs@npm:1.11.10"
checksum: 27e8f5bc01c0a76f36c656e62ab7f08c2e7b040b09e613cd4844abf03fb258e0350f0a83b02c887b84d771c1f11e092deda0beef8c6df2a1afbc3f6c1fade279
languageName: node
linkType: hard

"de-indent@npm:^1.0.2":
version: 1.0.2
resolution: "de-indent@npm:1.0.2"
Expand Down Expand Up @@ -11334,7 +11342,7 @@ __metadata:
languageName: node
linkType: hard

"jest-coverage-badges@npm:1.1.2, jest-coverage-badges@npm:^1.0.0":
"jest-coverage-badges@npm:1.1.2":
version: 1.1.2
resolution: "jest-coverage-badges@npm:1.1.2"
dependencies:
Expand Down Expand Up @@ -14804,13 +14812,6 @@ __metadata:
languageName: node
linkType: hard

"react-anchor-link-smooth-scroll@npm:^1.0.12":
version: 1.0.12
resolution: "react-anchor-link-smooth-scroll@npm:1.0.12"
checksum: ca4f4a12eca0d657b5d1a96980b7b27fd94b8a896dc426d425364069f001d92c4c596936ba7b526aa26535623216e823792dee86470d5e798ef54110d5a0e0b8
languageName: node
linkType: hard

"react-dom@npm:^18.1.0, react-dom@npm:^18.2.0":
version: 18.2.0
resolution: "react-dom@npm:18.2.0"
Expand Down Expand Up @@ -14929,20 +14930,7 @@ __metadata:
languageName: node
linkType: hard

"react-scroll@npm:^1.8.2":
version: 1.8.8
resolution: "react-scroll@npm:1.8.8"
dependencies:
lodash.throttle: "npm:^4.1.1"
prop-types: "npm:^15.7.2"
peerDependencies:
react: ^15.5.4 || ^16.0.0 || ^17.0.0 || ^18.0.0
react-dom: ^15.5.4 || ^16.0.0 || ^17.0.0 || ^18.0.0
checksum: e15900dfaef77aa186e58a427e8128167c6293a06e2fe2fc06d230f6767c8e4b463d72211773de14fde91ae1402aa457e2b80fb4b4dd915330fb2bbc7d14ddb6
languageName: node
linkType: hard

"react-test-renderer@npm:^16.0.0-0, react-test-renderer@npm:^16.9.0":
"react-test-renderer@npm:^16.0.0-0":
version: 16.14.0
resolution: "react-test-renderer@npm:16.14.0"
dependencies:
Expand Down

0 comments on commit 0fbbc6e

Please sign in to comment.