@openmrs/esm-form-engine-lib 4.2.2-pre.2653 → 4.2.2-pre.2657
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/dist/adapters/encounter-diagnosis-adapter.js +2 -1
- package/dist/adapters/orders-adapter.js +2 -2
- package/dist/src/adapters/encounter-diagnosis-adapter.d.ts.map +1 -1
- package/dist/src/adapters/orders-adapter.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/adapters/encounter-diagnosis-adapter.ts +2 -1
- package/src/adapters/orders-adapter.ts +2 -2
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { gracefullySetSubmission } from "../utils/common-utils.js";
|
|
1
|
+
import { clearSubmission, gracefullySetSubmission } from "../utils/common-utils.js";
|
|
2
2
|
import { isEmpty } from "../validators/form-validator.js";
|
|
3
3
|
import { isTrue } from "../utils/boolean-utils.js";
|
|
4
4
|
export let assignedDiagnosesIds = [];
|
|
5
5
|
export const EncounterDiagnosisAdapter = {
|
|
6
6
|
transformFieldValue: function(field, value, context) {
|
|
7
|
+
clearSubmission(field);
|
|
7
8
|
if (field.meta.initialValue?.omrsObject && isEmpty(value)) {
|
|
8
9
|
return gracefullySetSubmission(field, undefined, voidDiagnosis(field.meta.initialValue.omrsObject));
|
|
9
10
|
}
|
|
@@ -4,7 +4,8 @@ const defaultOrderType = 'testorder';
|
|
|
4
4
|
const defaultCareSetting = '6f0c9a92-6f24-11e3-af88-005056821db0';
|
|
5
5
|
export const OrdersAdapter = {
|
|
6
6
|
transformFieldValue: function(field, value, context) {
|
|
7
|
-
|
|
7
|
+
clearSubmission(field);
|
|
8
|
+
if (context.sessionMode === 'edit' && field.meta.initialValue?.omrsObject) {
|
|
8
9
|
return editOrder(value, field, context.currentProvider.uuid);
|
|
9
10
|
}
|
|
10
11
|
const newValue = constructNewOrder(value, field, context.currentProvider.uuid);
|
|
@@ -52,7 +53,6 @@ function constructNewOrder(value, field, orderer) {
|
|
|
52
53
|
function editOrder(newOrder, field, orderer) {
|
|
53
54
|
const previousOrder = field.meta.initialValue?.omrsObject;
|
|
54
55
|
if (newOrder === previousOrder?.concept?.uuid) {
|
|
55
|
-
clearSubmission(field);
|
|
56
56
|
return null;
|
|
57
57
|
}
|
|
58
58
|
const voided = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encounter-diagnosis-adapter.d.ts","sourceRoot":"","sources":["../../../src/adapters/encounter-diagnosis-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAEL,KAAK,qBAAqB,EAI3B,MAAM,UAAU,CAAC;AAMlB,eAAO,IAAI,oBAAoB,EAAE,MAAM,EAAO,CAAC;AAE/C,eAAO,MAAM,yBAAyB,EAAE,
|
|
1
|
+
{"version":3,"file":"encounter-diagnosis-adapter.d.ts","sourceRoot":"","sources":["../../../src/adapters/encounter-diagnosis-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAEL,KAAK,qBAAqB,EAI3B,MAAM,UAAU,CAAC;AAMlB,eAAO,IAAI,oBAAoB,EAAE,MAAM,EAAO,CAAC;AAE/C,eAAO,MAAM,yBAAyB,EAAE,qBA0DvC,CAAC;AAuCF,wBAAgB,gCAAgC,CAAC,iBAAiB,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,WAKpG;AAED,wBAAgB,aAAa,CAAC,SAAS,EAAE,eAAe;;;EAEvD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orders-adapter.d.ts","sourceRoot":"","sources":["../../../src/adapters/orders-adapter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,qBAAqB,EAAkC,MAAM,IAAI,CAAC;AAKhF,eAAO,IAAI,gBAAgB,EAAE,MAAM,EAAO,CAAC;AAI3C,eAAO,MAAM,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"orders-adapter.d.ts","sourceRoot":"","sources":["../../../src/adapters/orders-adapter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,qBAAqB,EAAkC,MAAM,IAAI,CAAC;AAKhF,eAAO,IAAI,gBAAgB,EAAE,MAAM,EAAO,CAAC;AAI3C,eAAO,MAAM,aAAa,EAAE,qBA6C3B,CAAC"}
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
type FormField,
|
|
8
8
|
} from '../types';
|
|
9
9
|
import { type FormContextProps } from '../provider/form-provider';
|
|
10
|
-
import { gracefullySetSubmission } from '../utils/common-utils';
|
|
10
|
+
import { clearSubmission, gracefullySetSubmission } from '../utils/common-utils';
|
|
11
11
|
import { isEmpty } from '../validators/form-validator';
|
|
12
12
|
import { isTrue } from '../utils/boolean-utils';
|
|
13
13
|
|
|
@@ -15,6 +15,7 @@ export let assignedDiagnosesIds: string[] = [];
|
|
|
15
15
|
|
|
16
16
|
export const EncounterDiagnosisAdapter: FormFieldValueAdapter = {
|
|
17
17
|
transformFieldValue: function (field: FormField, value: any, context: FormContextProps) {
|
|
18
|
+
clearSubmission(field);
|
|
18
19
|
if (field.meta.initialValue?.omrsObject && isEmpty(value)) {
|
|
19
20
|
return gracefullySetSubmission(field, undefined, voidDiagnosis(field.meta.initialValue.omrsObject as OpenmrsObs));
|
|
20
21
|
}
|
|
@@ -10,7 +10,8 @@ const defaultCareSetting = '6f0c9a92-6f24-11e3-af88-005056821db0';
|
|
|
10
10
|
|
|
11
11
|
export const OrdersAdapter: FormFieldValueAdapter = {
|
|
12
12
|
transformFieldValue: function (field: FormField, value: any, context: FormContextProps) {
|
|
13
|
-
|
|
13
|
+
clearSubmission(field);
|
|
14
|
+
if (context.sessionMode === 'edit' && field.meta.initialValue?.omrsObject) {
|
|
14
15
|
return editOrder(value, field, context.currentProvider.uuid);
|
|
15
16
|
}
|
|
16
17
|
const newValue = constructNewOrder(value, field, context.currentProvider.uuid);
|
|
@@ -70,7 +71,6 @@ function constructNewOrder(value: any, field: FormField, orderer: string) {
|
|
|
70
71
|
function editOrder(newOrder: any, field: FormField, orderer: string) {
|
|
71
72
|
const previousOrder = field.meta.initialValue?.omrsObject as OpenmrsResource;
|
|
72
73
|
if (newOrder === previousOrder?.concept?.uuid) {
|
|
73
|
-
clearSubmission(field);
|
|
74
74
|
return null;
|
|
75
75
|
}
|
|
76
76
|
const voided = {
|