openchs-models 1.32.16 → 1.32.18
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/Schema.js +16 -1
- package/dist/application/FormElementGroup.js +5 -16
- package/package.json +1 -1
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: 198,
|
|
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.`);
|
|
@@ -950,6 +950,21 @@ function createRealmConfig() {
|
|
|
950
950
|
const dashboardCache = newDB.objects("DashboardCache");
|
|
951
951
|
newDB.delete(dashboardCache);
|
|
952
952
|
}
|
|
953
|
+
|
|
954
|
+
if (oldDB.schemaVersion < 198) {
|
|
955
|
+
const oldObjects = oldDB.objects(_FormElementGroup.default.schema.name);
|
|
956
|
+
const newObjects = newDB.objects(_FormElementGroup.default.schema.name); // loop through all objects and set the name property in the
|
|
957
|
+
// new schema to display property
|
|
958
|
+
|
|
959
|
+
for (const objectIndex in oldObjects) {
|
|
960
|
+
const oldObject = oldObjects[objectIndex];
|
|
961
|
+
const newObject = newObjects[objectIndex];
|
|
962
|
+
|
|
963
|
+
if (!_lodash.default.isEmpty(oldObject.display) && oldObject.name !== oldObject.display) {
|
|
964
|
+
newObject.name = oldObject.display;
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
}
|
|
953
968
|
}
|
|
954
969
|
};
|
|
955
970
|
}
|
|
@@ -48,14 +48,6 @@ 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
|
-
|
|
59
51
|
get formElements() {
|
|
60
52
|
return this.toEntityList("formElements", _FormElement.default);
|
|
61
53
|
}
|
|
@@ -121,7 +113,7 @@ class FormElementGroup extends _BaseEntity.default {
|
|
|
121
113
|
}
|
|
122
114
|
|
|
123
115
|
static fromResource(resource, entityService) {
|
|
124
|
-
const formElementGroup = _General.default.assignFields(resource, new FormElementGroup(), ["uuid", "name", "displayOrder", "
|
|
116
|
+
const formElementGroup = _General.default.assignFields(resource, new FormElementGroup(), ["uuid", "name", "displayOrder", "voided", "rule", "startTime", "stayTime", "timed", "textColour", "backgroundColour"]);
|
|
125
117
|
|
|
126
118
|
formElementGroup.form = entityService.findByKey("uuid", _ResourceUtil.default.getUUIDFor(resource, "formUUID"), _Form.default.schema.name);
|
|
127
119
|
return formElementGroup;
|
|
@@ -226,9 +218,11 @@ class FormElementGroup extends _BaseEntity.default {
|
|
|
226
218
|
}
|
|
227
219
|
|
|
228
220
|
nonVoidedFormElements() {
|
|
221
|
+
const mapOfFormElementsByUUID = _lodash.default.keyBy(this.formElements, 'uuid');
|
|
222
|
+
|
|
229
223
|
return _lodash.default.filter(this.formElements, formElement => {
|
|
230
224
|
let parentFormElement;
|
|
231
|
-
if (!_lodash.default.isNil(formElement.groupUuid)) parentFormElement =
|
|
225
|
+
if (!_lodash.default.isNil(formElement.groupUuid)) parentFormElement = mapOfFormElementsByUUID[formElement.groupUuid];
|
|
232
226
|
return !formElement.voided && (_lodash.default.isNil(parentFormElement) || !parentFormElement.voided);
|
|
233
227
|
});
|
|
234
228
|
}
|
|
@@ -242,7 +236,7 @@ class FormElementGroup extends _BaseEntity.default {
|
|
|
242
236
|
}
|
|
243
237
|
|
|
244
238
|
get translatedFieldValue() {
|
|
245
|
-
return this.
|
|
239
|
+
return this.name;
|
|
246
240
|
}
|
|
247
241
|
|
|
248
242
|
removeFormElement(formElementName) {
|
|
@@ -291,7 +285,6 @@ class FormElementGroup extends _BaseEntity.default {
|
|
|
291
285
|
uuid: this.uuid,
|
|
292
286
|
name: this.name,
|
|
293
287
|
displayOrder: this.displayOrder,
|
|
294
|
-
display: this.display,
|
|
295
288
|
formElements: this.formElements,
|
|
296
289
|
formUUID: this.form.uuid,
|
|
297
290
|
startTime: this.startTime,
|
|
@@ -311,10 +304,6 @@ _defineProperty(FormElementGroup, "schema", {
|
|
|
311
304
|
uuid: "string",
|
|
312
305
|
name: "string",
|
|
313
306
|
displayOrder: "double",
|
|
314
|
-
display: {
|
|
315
|
-
type: "string",
|
|
316
|
-
optional: true
|
|
317
|
-
},
|
|
318
307
|
formElements: {
|
|
319
308
|
type: "list",
|
|
320
309
|
objectType: "FormElement"
|