openchs-models 1.27.4 → 1.27.5

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/Makefile CHANGED
@@ -31,9 +31,11 @@ publish:
31
31
  copy-dist-to-avni-client:
32
32
  cp -r * ../avni-client/packages/openchs-android/node_modules/openchs-models/
33
33
 
34
- deploy-to-avni-client:
34
+ deploy-to-avni-client-only:
35
35
  $(if $(local),$(call _deploy,$(local)/packages/openchs-android/node_modules/openchs-models))
36
36
 
37
+ deploy-to-avni-client: build deploy-to-avni-client-only
38
+
37
39
  deploy-to-avni-web:
38
40
  $(if $(local),$(call _deploy,$(local)/node_modules/openchs-models))
39
41
 
@@ -19,6 +19,13 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
19
19
 
20
20
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
21
21
 
22
+ const clone = function (concept, valueJSON) {
23
+ const observation = new Observation();
24
+ observation.concept = concept;
25
+ observation.valueJSON = valueJSON;
26
+ return observation;
27
+ };
28
+
22
29
  class Observation {
23
30
  static create(concept, value, abnormal = false) {
24
31
  const observation = new Observation();
@@ -136,10 +143,11 @@ class Observation {
136
143
  }
137
144
 
138
145
  cloneForEdit() {
139
- const observation = new Observation();
140
- observation.concept = this.concept.cloneForReference();
141
- observation.valueJSON = this.getValueWrapper().cloneForEdit();
142
- return observation;
146
+ return clone(this.concept.cloneForReference(), this.getValueWrapper().cloneForEdit());
147
+ }
148
+
149
+ shallowClone() {
150
+ return clone(this.concept, this.valueJSON);
143
151
  }
144
152
 
145
153
  getValueWrapper() {
@@ -253,6 +253,14 @@ class Form {
253
253
  return mandatoryConcepts;
254
254
  }
255
255
 
256
+ getAllFormElementConcepts() {
257
+ let concepts = [];
258
+ this.formElementGroups.forEach(feg => {
259
+ concepts = _lodash.default.concat(concepts, feg.getAllFormElementConcepts());
260
+ });
261
+ return concepts;
262
+ }
263
+
256
264
  }
257
265
 
258
266
  _defineProperty(Form, "schema", {
@@ -183,6 +183,10 @@ class FormElementGroup {
183
183
  }, true);
184
184
  }
185
185
 
186
+ getAllFormElementConcepts() {
187
+ return this.formElements.map(x => x.concept);
188
+ }
189
+
186
190
  toJSON() {
187
191
  return {
188
192
  uuid: this.uuid,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "openchs-models",
3
3
  "description": "OpenCHS data model to be used by front end clients",
4
- "version": "1.27.4",
4
+ "version": "1.27.5",
5
5
  "private": false,
6
6
  "repository": {
7
7
  "type": "git",