@openmrs/ngx-formentry 3.0.1-pre.100 → 3.0.1-pre.105
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/bundles/openmrs-ngx-formentry.umd.js +13 -7
- package/bundles/openmrs-ngx-formentry.umd.js.map +1 -1
- package/esm2015/form-entry/helpers/js-expression-helper.js +14 -8
- package/fesm2015/openmrs-ngx-formentry.js +13 -7
- package/fesm2015/openmrs-ngx-formentry.js.map +1 -1
- package/form-entry/helpers/js-expression-helper.d.ts +10 -2
- package/package.json +1 -1
|
@@ -2086,17 +2086,23 @@
|
|
|
2086
2086
|
return array.indexOf(members) !== -1;
|
|
2087
2087
|
}
|
|
2088
2088
|
};
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2089
|
+
/**
|
|
2090
|
+
* Takes a target control, an encounter and concept uuid. If the target control has a value it returns it
|
|
2091
|
+
* otherwise it tries to find it in the encounter. Finally it returns null of it can't find either of them.
|
|
2092
|
+
* @param targetControl
|
|
2093
|
+
* @param rawEncounter
|
|
2094
|
+
* @param uuid
|
|
2095
|
+
* @returns
|
|
2096
|
+
*/
|
|
2097
|
+
JsExpressionHelper.prototype.getObsFromControlOrEncounter = function (targetControl, rawEncounter, uuid) {
|
|
2093
2098
|
var _a;
|
|
2094
2099
|
var findObs = function (obs, uuid) {
|
|
2095
2100
|
var result;
|
|
2096
|
-
obs === null || obs === void 0 ? void 0 : obs.some(function (o) { var _a; return result = ((_a = o === null || o === void 0 ? void 0 : o.concept) === null || _a === void 0 ? void 0 : _a.uuid) === uuid ? o : findObs(o.
|
|
2101
|
+
obs === null || obs === void 0 ? void 0 : obs.some(function (o) { var _a; return result = ((_a = o === null || o === void 0 ? void 0 : o.concept) === null || _a === void 0 ? void 0 : _a.uuid) === uuid ? o : findObs(o.groupMembers || [], uuid); });
|
|
2097
2102
|
return result;
|
|
2098
2103
|
};
|
|
2099
|
-
|
|
2104
|
+
var obsValue = (_a = findObs(rawEncounter === null || rawEncounter === void 0 ? void 0 : rawEncounter.obs, uuid)) === null || _a === void 0 ? void 0 : _a.value;
|
|
2105
|
+
return !!targetControl ? targetControl : typeof obsValue === 'object' ? obsValue.uuid : !!obsValue ? obsValue : null;
|
|
2100
2106
|
};
|
|
2101
2107
|
Object.defineProperty(JsExpressionHelper.prototype, "helperFunctions", {
|
|
2102
2108
|
get: function () {
|
|
@@ -2111,7 +2117,7 @@
|
|
|
2111
2117
|
isEmpty: helper.isEmpty,
|
|
2112
2118
|
arrayContains: helper.arrayContains,
|
|
2113
2119
|
extractRepeatingGroupValues: helper.extractRepeatingGroupValues,
|
|
2114
|
-
|
|
2120
|
+
getObsFromControlOrEncounter: helper.getObsFromControlOrEncounter
|
|
2115
2121
|
};
|
|
2116
2122
|
},
|
|
2117
2123
|
enumerable: false,
|