Skip to content

Commit ff66b14

Browse files
Merge branch 'main' of https://github.com/openmrs/openmrs-esm-form-builder into feat/validation-rule-builder
2 parents 800e66d + 190cf27 commit ff66b14

File tree

14 files changed

+206
-264
lines changed

14 files changed

+206
-264
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ The Form Builder is a widget used to create OpenMRS form schemas. It enables use
1111

1212
## Running this code
1313

14-
Under the hood, the Form Builder uses the [OHRI form engine](https://www.npmjs.com/package/@openmrs/openmrs-form-engine-lib) to render a visual representation of your schema. This visual preview gets progressively updated as you build your schema. When done building, you can save your schema to an OpenMRS server. You can also publish your schema to make it available to your frontend.
14+
Under the hood, the Form Builder uses the [React form engine](https://www.npmjs.com/package/@openmrs/esm-form-engine-lib) to render a visual representation of your schema. This visual preview gets progressively updated as you build your schema. When done building, you can save your schema to an OpenMRS server. You can also publish your schema to make it available to your frontend.
1515

1616
To set up environment variables for the project, follow these steps:
1717

@@ -95,7 +95,7 @@ Then, in a separate terminal, run:
9595
yarn test-e2e --headed
9696
```
9797

98-
Read the [e2e testing guide](/e2e/README.md) to learn more about End-to-End tests in this project.
98+
Read the [E2E testing guide](https://o3-docs.openmrs.org/docs/frontend-modules/end-to-end-testing) to learn more about End-to-End tests in this project.
9999

100100
#### Troubleshooting
101101

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"coverage": "yarn test --coverage --passWithNoTests",
2121
"postinstall": "husky install",
2222
"extract-translations": "i18next 'src/**/*.component.tsx' 'src/**/*.modal.tsx' --config ./i18next-parser.config.js",
23-
"ci:bump-form-engine-lib": "yarn up @openmrs/openmrs-form-engine-lib@next"
23+
"ci:bump-form-engine-lib": "yarn up @openmrs/esm-form-engine-lib@next"
2424
},
2525
"files": [
2626
"dist",
@@ -47,7 +47,7 @@
4747
},
4848
"dependencies": {
4949
"@carbon/react": "^1.47.0",
50-
"@openmrs/openmrs-form-engine-lib": "next",
50+
"@openmrs/esm-form-engine-lib": "next",
5151
"ajv": "^8.13.0",
5252
"dotenv": "^16.4.5",
5353
"file-loader": "^6.2.0",

src/components/form-editor/form-editor.component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { useParams } from 'react-router-dom';
2020
import { type TFunction, useTranslation } from 'react-i18next';
2121
import { ConfigurableLink, showModal, useConfig } from '@openmrs/esm-framework';
2222
import type { IMarker } from 'react-ace';
23-
import type { FormSchema } from '@openmrs/openmrs-form-engine-lib';
23+
import type { FormSchema } from '@openmrs/esm-form-engine-lib';
2424
import type { Schema } from '../../types';
2525
import { useClobdata } from '../../hooks/useClobdata';
2626
import { useForm } from '../../hooks/useForm';

src/components/form-renderer/form-renderer.component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react';
22
import { ErrorBoundary } from 'react-error-boundary';
33
import { useTranslation } from 'react-i18next';
44
import { Button, InlineLoading, Tile } from '@carbon/react';
5-
import { type FormSchema, FormEngine } from '@openmrs/openmrs-form-engine-lib';
5+
import { type FormSchema, FormEngine } from '@openmrs/esm-form-engine-lib';
66
import styles from './form-renderer.scss';
77

88
interface ErrorFallbackProps {

src/components/interactive-builder/add-question.modal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import {
2727
} from '@carbon/react';
2828
import { ArrowUpRight } from '@carbon/react/icons';
2929
import { showSnackbar, useConfig, useDebounce } from '@openmrs/esm-framework';
30-
import type { ProgramState, RenderType } from '@openmrs/openmrs-form-engine-lib';
30+
import type { ProgramState, RenderType } from '@openmrs/esm-form-engine-lib';
3131

3232
import type { ConfigObject } from '../../config-schema';
3333
import type {

src/components/interactive-builder/edit-question.modal.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import {
2727
} from '@carbon/react';
2828
import { ArrowUpRight } from '@carbon/react/icons';
2929
import { showSnackbar, useConfig } from '@openmrs/esm-framework';
30-
import type { ProgramState, RenderType } from '@openmrs/openmrs-form-engine-lib';
30+
import type { ProgramState, RenderType } from '@openmrs/esm-form-engine-lib';
3131

3232
import type { ConfigObject } from '../../config-schema';
3333
import type {
@@ -144,7 +144,10 @@ const EditQuestionModal: React.FC<EditQuestionModalProps> = ({
144144
);
145145
const [programWorkflows, setProgramWorkflows] = useState<Array<ProgramWorkflow>>([]);
146146

147-
const hasConceptChanged = selectedConcept && questionToEdit?.questionOptions?.concept !== selectedConcept?.uuid;
147+
const hasConceptChanged =
148+
selectedConcept &&
149+
questionToEdit?.questionOptions.concept &&
150+
questionToEdit?.questionOptions?.concept !== selectedConcept?.uuid;
148151
const [addInlineDate, setAddInlineDate] = useState(false);
149152

150153
// Maps the data type of a concept to a date picker type.
@@ -276,8 +279,8 @@ const EditQuestionModal: React.FC<EditQuestionModalProps> = ({
276279
rendering: fieldType ? fieldType : questionToEdit.questionOptions.rendering,
277280
...((selectedConcept || questionToEdit.questionOptions.concept) && {
278281
concept: selectedConcept ? selectedConcept.uuid : questionToEdit.questionOptions.concept,
282+
conceptMappings: conceptMappings?.length ? conceptMappings : questionToEdit.questionOptions.conceptMappings,
279283
}),
280-
conceptMappings: conceptMappings?.length ? conceptMappings : questionToEdit.questionOptions.conceptMappings,
281284
answers: mappedAnswers,
282285
...(questionType === 'patientIdentifier' && {
283286
identifierType: selectedPatientIdentifierType

src/components/interactive-builder/interactive-builder.component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { Accordion, AccordionItem, Button, IconButton, InlineLoading } from '@ca
66
import { Add, TrashCan } from '@carbon/react/icons';
77
import { useParams } from 'react-router-dom';
88
import { showModal, showSnackbar, useFeatureFlag } from '@openmrs/esm-framework';
9-
import type { FormSchema } from '@openmrs/openmrs-form-engine-lib';
9+
import type { FormSchema } from '@openmrs/esm-form-engine-lib';
1010
import type { Schema, Question } from '../../types';
1111
import DraggableQuestion from './draggable-question.component';
1212
import Droppable from './droppable-container.component';

src/config-schema.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Type } from '@openmrs/esm-framework';
2-
import { type RenderType } from '@openmrs/openmrs-form-engine-lib';
2+
import { type RenderType } from '@openmrs/esm-form-engine-lib';
33
import { type QuestionType } from './types';
44

55
export const configSchema = {

src/hooks/useConceptName.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ export function useConceptName(conceptId: string | undefined) {
1010
return {
1111
conceptName: data?.data?.name?.display ?? null,
1212
conceptNameLookupError: error,
13-
isLoadingConceptName: (!data && !error) || false,
13+
isLoadingConceptName: (conceptId && !data && !error) || false,
1414
};
1515
}

src/hooks/useProgramStates.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import useSWR from 'swr';
22
import { openmrsFetch, restBaseUrl } from '@openmrs/esm-framework';
3-
import { type ProgramWorkflowState } from '@openmrs/openmrs-form-engine-lib';
3+
import { type ProgramWorkflowState } from '@openmrs/esm-form-engine-lib';
44
import { type Program, type ProgramWorkflow } from '../types';
55

66
export function usePrograms() {

0 commit comments

Comments
 (0)