openchs-models 1.32.14 → 1.32.15
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/Duration.js +1 -1
- package/dist/ReportCard.js +4 -0
- package/dist/Schema.js +7 -16
- package/dist/application/FormElementGroup.js +15 -2
- package/package.json +1 -1
package/dist/Duration.js
CHANGED
|
@@ -16,7 +16,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
16
16
|
class Duration {
|
|
17
17
|
constructor(durationValue, durationUnit) {
|
|
18
18
|
this._durationValue = durationValue;
|
|
19
|
-
this.durationUnit = durationUnit;
|
|
19
|
+
this.durationUnit = durationUnit || Duration.Day;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
static inDay(value) {
|
package/dist/ReportCard.js
CHANGED
|
@@ -136,6 +136,10 @@ class ReportCard extends _BaseEntity.default {
|
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
getStandardReportCardInputRecentDuration() {
|
|
139
|
+
if (_lodash.default.isEmpty(this.that.standardReportCardInputRecentDurationJSON)) {
|
|
140
|
+
return new _Duration.default(1, _Duration.default.Day);
|
|
141
|
+
}
|
|
142
|
+
|
|
139
143
|
const duration = JSON.parse(this.that.standardReportCardInputRecentDurationJSON);
|
|
140
144
|
return new _Duration.default(duration.value, duration.unit);
|
|
141
145
|
}
|
package/dist/Schema.js
CHANGED
|
@@ -283,7 +283,7 @@ function createRealmConfig() {
|
|
|
283
283
|
return doCompact;
|
|
284
284
|
},
|
|
285
285
|
//order is important, should be arranged according to the dependency
|
|
286
|
-
schemaVersion:
|
|
286
|
+
schemaVersion: 197,
|
|
287
287
|
onMigration: function (oldDB, newDB) {
|
|
288
288
|
console.log("[AvniModels.Schema]", `Running migration with old schema version: ${oldDB.schemaVersion} and new schema version: ${newDB.schemaVersion}`);
|
|
289
289
|
if (oldDB.schemaVersion === VersionWithEmbeddedMigrationProblem) throw new Error(`Update from schema version ${VersionWithEmbeddedMigrationProblem} is not allowed. Please uninstall and install app.`);
|
|
@@ -937,27 +937,18 @@ function createRealmConfig() {
|
|
|
937
937
|
}
|
|
938
938
|
|
|
939
939
|
standardReportCardType.type = _lodash.default.replace(_lodash.default.startCase(standardReportCardType.description), new RegExp(' ', 'g'), '');
|
|
940
|
+
});
|
|
941
|
+
|
|
942
|
+
_lodash.default.forEach(newDB.objects(_ReportCard.default.schema.name), card => {
|
|
943
|
+
card.standardReportCardInputSubjectTypes = [];
|
|
944
|
+
card.standardReportCardInputPrograms = [];
|
|
945
|
+
card.standardReportCardInputEncounterTypes = [];
|
|
940
946
|
}); //Reset MyDashboard cache because shape of filterJSON in cache has changed
|
|
941
947
|
|
|
942
948
|
|
|
943
949
|
const dashboardCache = newDB.objects("DashboardCache");
|
|
944
950
|
newDB.delete(dashboardCache);
|
|
945
951
|
}
|
|
946
|
-
|
|
947
|
-
if (oldDB.schemaVersion < 198) {
|
|
948
|
-
const oldObjects = oldDB.objects(_FormElementGroup.default.schema.name);
|
|
949
|
-
const newObjects = newDB.objects(_FormElementGroup.default.schema.name); // loop through all objects and set the name property in the
|
|
950
|
-
// new schema to display property
|
|
951
|
-
|
|
952
|
-
for (const objectIndex in oldObjects) {
|
|
953
|
-
const oldObject = oldObjects[objectIndex];
|
|
954
|
-
const newObject = newObjects[objectIndex];
|
|
955
|
-
|
|
956
|
-
if (!_lodash.default.isEmpty(oldObject.display) && oldObject.name !== oldObject.display) {
|
|
957
|
-
newObject.name = oldObject.display;
|
|
958
|
-
}
|
|
959
|
-
}
|
|
960
|
-
}
|
|
961
952
|
}
|
|
962
953
|
};
|
|
963
954
|
}
|
|
@@ -48,6 +48,14 @@ class FormElementGroup extends _BaseEntity.default {
|
|
|
48
48
|
this.that.displayOrder = x;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
get display() {
|
|
52
|
+
return this.that.display;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
set display(x) {
|
|
56
|
+
this.that.display = x;
|
|
57
|
+
}
|
|
58
|
+
|
|
51
59
|
get formElements() {
|
|
52
60
|
return this.toEntityList("formElements", _FormElement.default);
|
|
53
61
|
}
|
|
@@ -113,7 +121,7 @@ class FormElementGroup extends _BaseEntity.default {
|
|
|
113
121
|
}
|
|
114
122
|
|
|
115
123
|
static fromResource(resource, entityService) {
|
|
116
|
-
const formElementGroup = _General.default.assignFields(resource, new FormElementGroup(), ["uuid", "name", "displayOrder", "voided", "rule", "startTime", "stayTime", "timed", "textColour", "backgroundColour"]);
|
|
124
|
+
const formElementGroup = _General.default.assignFields(resource, new FormElementGroup(), ["uuid", "name", "displayOrder", "display", "voided", "rule", "startTime", "stayTime", "timed", "textColour", "backgroundColour"]);
|
|
117
125
|
|
|
118
126
|
formElementGroup.form = entityService.findByKey("uuid", _ResourceUtil.default.getUUIDFor(resource, "formUUID"), _Form.default.schema.name);
|
|
119
127
|
return formElementGroup;
|
|
@@ -234,7 +242,7 @@ class FormElementGroup extends _BaseEntity.default {
|
|
|
234
242
|
}
|
|
235
243
|
|
|
236
244
|
get translatedFieldValue() {
|
|
237
|
-
return this.
|
|
245
|
+
return this.display;
|
|
238
246
|
}
|
|
239
247
|
|
|
240
248
|
removeFormElement(formElementName) {
|
|
@@ -283,6 +291,7 @@ class FormElementGroup extends _BaseEntity.default {
|
|
|
283
291
|
uuid: this.uuid,
|
|
284
292
|
name: this.name,
|
|
285
293
|
displayOrder: this.displayOrder,
|
|
294
|
+
display: this.display,
|
|
286
295
|
formElements: this.formElements,
|
|
287
296
|
formUUID: this.form.uuid,
|
|
288
297
|
startTime: this.startTime,
|
|
@@ -302,6 +311,10 @@ _defineProperty(FormElementGroup, "schema", {
|
|
|
302
311
|
uuid: "string",
|
|
303
312
|
name: "string",
|
|
304
313
|
displayOrder: "double",
|
|
314
|
+
display: {
|
|
315
|
+
type: "string",
|
|
316
|
+
optional: true
|
|
317
|
+
},
|
|
305
318
|
formElements: {
|
|
306
319
|
type: "list",
|
|
307
320
|
objectType: "FormElement"
|