Skip to content

Commit

Permalink
(chore) Update the Openmrs Form Engine library to use the latest pack…
Browse files Browse the repository at this point in the history
…age ID or name (#338)

* Update RFE library

* Fixup
  • Loading branch information
samuelmale authored Aug 8, 2024
1 parent 43d8af7 commit 988016a
Show file tree
Hide file tree
Showing 13 changed files with 199 additions and 260 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The Form Builder is a widget used to create OpenMRS form schemas. It enables use

## Running this code

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.
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.

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

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"coverage": "yarn test --coverage --passWithNoTests",
"postinstall": "husky install",
"extract-translations": "i18next 'src/**/*.component.tsx' 'src/**/*.modal.tsx' --config ./i18next-parser.config.js",
"ci:bump-form-engine-lib": "yarn up @openmrs/openmrs-form-engine-lib@next"
"ci:bump-form-engine-lib": "yarn up @openmrs/esm-form-engine-lib@next"
},
"files": [
"dist",
Expand All @@ -47,7 +47,7 @@
},
"dependencies": {
"@carbon/react": "^1.47.0",
"@openmrs/openmrs-form-engine-lib": "next",
"@openmrs/esm-form-engine-lib": "next",
"ajv": "^8.13.0",
"dotenv": "^16.4.5",
"file-loader": "^6.2.0",
Expand Down
2 changes: 1 addition & 1 deletion src/components/form-editor/form-editor.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { useParams } from 'react-router-dom';
import { type TFunction, useTranslation } from 'react-i18next';
import { ConfigurableLink, showModal, useConfig } from '@openmrs/esm-framework';
import type { IMarker } from 'react-ace';
import type { FormSchema } from '@openmrs/openmrs-form-engine-lib';
import type { FormSchema } from '@openmrs/esm-form-engine-lib';
import type { Schema } from '../../types';
import { useClobdata } from '../../hooks/useClobdata';
import { useForm } from '../../hooks/useForm';
Expand Down
2 changes: 1 addition & 1 deletion src/components/form-renderer/form-renderer.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react';
import { ErrorBoundary } from 'react-error-boundary';
import { useTranslation } from 'react-i18next';
import { Button, InlineLoading, Tile } from '@carbon/react';
import { type FormSchema, FormEngine } from '@openmrs/openmrs-form-engine-lib';
import { type FormSchema, FormEngine } from '@openmrs/esm-form-engine-lib';
import styles from './form-renderer.scss';

interface ErrorFallbackProps {
Expand Down
2 changes: 1 addition & 1 deletion src/components/interactive-builder/add-question.modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
} from '@carbon/react';
import { ArrowUpRight } from '@carbon/react/icons';
import { showSnackbar, useConfig, useDebounce } from '@openmrs/esm-framework';
import type { ProgramState, RenderType } from '@openmrs/openmrs-form-engine-lib';
import type { ProgramState, RenderType } from '@openmrs/esm-form-engine-lib';

import type { ConfigObject } from '../../config-schema';
import type {
Expand Down
2 changes: 1 addition & 1 deletion src/components/interactive-builder/edit-question.modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
} from '@carbon/react';
import { ArrowUpRight } from '@carbon/react/icons';
import { showSnackbar, useConfig } from '@openmrs/esm-framework';
import type { ProgramState, RenderType } from '@openmrs/openmrs-form-engine-lib';
import type { ProgramState, RenderType } from '@openmrs/esm-form-engine-lib';

import type { ConfigObject } from '../../config-schema';
import type {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Accordion, AccordionItem, Button, IconButton, InlineLoading } from '@ca
import { Add, TrashCan } from '@carbon/react/icons';
import { useParams } from 'react-router-dom';
import { showModal, showSnackbar } from '@openmrs/esm-framework';
import type { FormSchema } from '@openmrs/openmrs-form-engine-lib';
import type { FormSchema } from '@openmrs/esm-form-engine-lib';
import type { Schema, Question } from '../../types';
import DraggableQuestion from './draggable-question.component';
import Droppable from './droppable-container.component';
Expand Down
2 changes: 1 addition & 1 deletion src/config-schema.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Type } from '@openmrs/esm-framework';
import { type RenderType } from '@openmrs/openmrs-form-engine-lib';
import { type RenderType } from '@openmrs/esm-form-engine-lib';
import { type QuestionType } from './types';

export const configSchema = {
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useProgramStates.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import useSWR from 'swr';
import { openmrsFetch, restBaseUrl } from '@openmrs/esm-framework';
import { type ProgramWorkflowState } from '@openmrs/openmrs-form-engine-lib';
import { type ProgramWorkflowState } from '@openmrs/esm-form-engine-lib';
import { type Program, type ProgramWorkflow } from '../types';

export function usePrograms() {
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { OpenmrsResource } from '@openmrs/esm-framework';
import type { ProgramState, ReferencedForm, RenderType, RequiredFieldProps } from '@openmrs/openmrs-form-engine-lib';
import type { ProgramState, ReferencedForm, RenderType, RequiredFieldProps } from '@openmrs/esm-form-engine-lib';
import type { AuditInfo } from './components/audit-details/audit-details.component';

export interface Form {
Expand Down
5 changes: 3 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@
"es2015.promise",
"es2016.array.include",
"es2018",
"es2020"
"es2020",
"esnext"
],
"module": "esnext",
"moduleResolution": "node",
"noEmit": true,
"noImplicitAny": false,
"resolveJsonModule": true,
"skipLibCheck": true,
"target": "esnext"
"target": "es2015"
},
"types": ["@testing-library/jest-dom", "lodash"],
}
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ config.overrides.resolve = {
extensions: ['.tsx', '.ts', '.jsx', '.js', '.scss', '.json'],
alias: {
'@openmrs/esm-framework': '@openmrs/esm-framework/src/internal',
'@openmrs/openmrs-form-engine-lib': '@openmrs/openmrs-form-engine-lib/src/index',
'@openmrs/esm-form-engine-lib': '@openmrs/esm-form-engine-lib/src/index',
},
};
module.exports = config;
Loading

0 comments on commit 988016a

Please sign in to comment.