@openmrs/esm-form-engine-lib 2.1.0-pre.1376 → 2.1.0-pre.1384

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-form-engine-lib",
3
- "version": "2.1.0-pre.1376",
3
+ "version": "2.1.0-pre.1384",
4
4
  "description": "React Form Engine for O3",
5
5
  "browser": "dist/openmrs-esm-form-engine-lib.js",
6
6
  "main": "src/index.ts",
@@ -29,7 +29,7 @@ export const ProgramStateAdapter: FormFieldValueAdapter = {
29
29
  .filter((state) => !state.endDate)
30
30
  .find((state) => state.state.programWorkflow?.uuid === field.questionOptions.workflowUuid)?.state;
31
31
  field.meta = { ...(field.meta || {}), previousValue: currentState };
32
- return currentState.uuid;
32
+ return currentState?.uuid;
33
33
  }
34
34
  return null;
35
35
  },
@@ -77,6 +77,7 @@ const contextInitializableTypes = [
77
77
  'encounterLocation',
78
78
  'patientIdentifier',
79
79
  'encounterRole',
80
+ 'programState'
80
81
  ];
81
82
  export class EncounterFormProcessor extends FormProcessor {
82
83
  prepareFormSchema(schema: FormSchema) {
@@ -257,7 +258,11 @@ export class EncounterFormProcessor extends FormProcessor {
257
258
  const adapter = formFieldAdapters[field.type];
258
259
  initialValues[field.id] = emptyValues[field.questionOptions.rendering] ?? null;
259
260
  if (field.questionOptions.calculate?.calculateExpression) {
260
- await evaluateCalculateExpression(field, initialValues, context);
261
+ try {
262
+ await evaluateCalculateExpression(field, initialValues, context);
263
+ } catch (error) {
264
+ console.error(error);
265
+ }
261
266
  }
262
267
  if (isEmpty(initialValues[field.id]) && contextInitializableTypes.includes(field.type)) {
263
268
  try {
@@ -17,6 +17,7 @@ export function validateForm(context: FormContextProps) {
17
17
  } = context;
18
18
  const values = getValues();
19
19
  const errors = formFields
20
+ .filter((field) => !field.isHidden && !field.isDisabled)
20
21
  .flatMap((field) =>
21
22
  field.validators?.flatMap((validatorConfig) => {
22
23
  const validator = formFieldValidators[validatorConfig.type];