openchs-models 1.33.44 → 1.33.45
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 +1 -1
- package/dist/application/Form.js +50 -1
- package/package.json +1 -1
package/dist/Schema.js
CHANGED
|
@@ -181,7 +181,7 @@ function createRealmConfig() {
|
|
|
181
181
|
return doCompact;
|
|
182
182
|
},
|
|
183
183
|
//order is important, should be arranged according to the dependency
|
|
184
|
-
schemaVersion:
|
|
184
|
+
schemaVersion: 211,
|
|
185
185
|
onMigration: function (oldDB, newDB) {
|
|
186
186
|
console.log("[AvniModels.Schema]", `Running migration with old schema version: ${oldDB.schemaVersion} and new schema version: ${newDB.schemaVersion}`);
|
|
187
187
|
if (oldDB.schemaVersion === VersionWithEmbeddedMigrationProblem) throw new Error(`Update from schema version ${VersionWithEmbeddedMigrationProblem} is not allowed. Please uninstall and install app.`);
|
package/dist/application/Form.js
CHANGED
|
@@ -76,6 +76,39 @@ class Form extends _BaseEntity.default {
|
|
|
76
76
|
set taskScheduleRule(x) {
|
|
77
77
|
this.that.taskScheduleRule = x;
|
|
78
78
|
}
|
|
79
|
+
get shareRule() {
|
|
80
|
+
return this.that.shareRule;
|
|
81
|
+
}
|
|
82
|
+
set shareRule(x) {
|
|
83
|
+
this.that.shareRule = x;
|
|
84
|
+
}
|
|
85
|
+
get shareTemplateS3Key() {
|
|
86
|
+
return this.that.shareTemplateS3Key;
|
|
87
|
+
}
|
|
88
|
+
set shareTemplateS3Key(x) {
|
|
89
|
+
this.that.shareTemplateS3Key = x;
|
|
90
|
+
}
|
|
91
|
+
get shareTranslations() {
|
|
92
|
+
return this.that.shareTranslations;
|
|
93
|
+
}
|
|
94
|
+
set shareTranslations(x) {
|
|
95
|
+
this.that.shareTranslations = x;
|
|
96
|
+
}
|
|
97
|
+
hasShareRule() {
|
|
98
|
+
return !_lodash.default.isEmpty(_lodash.default.trim(this.shareRule));
|
|
99
|
+
}
|
|
100
|
+
hasShareTemplate() {
|
|
101
|
+
return !_lodash.default.isEmpty(_lodash.default.trim(this.shareTemplateS3Key));
|
|
102
|
+
}
|
|
103
|
+
getShareTranslations() {
|
|
104
|
+
if (!this.shareTranslations) return {};
|
|
105
|
+
try {
|
|
106
|
+
const parsed = JSON.parse(this.shareTranslations);
|
|
107
|
+
return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {};
|
|
108
|
+
} catch (e) {
|
|
109
|
+
return {};
|
|
110
|
+
}
|
|
111
|
+
}
|
|
79
112
|
static safeInstance() {
|
|
80
113
|
const form = new Form();
|
|
81
114
|
form.formElementGroups = [];
|
|
@@ -88,7 +121,11 @@ class Form extends _BaseEntity.default {
|
|
|
88
121
|
return this;
|
|
89
122
|
}
|
|
90
123
|
static fromResource(resource, entityService) {
|
|
91
|
-
|
|
124
|
+
const form = _General.default.assignFields(resource, new Form(), ["uuid", "name", "formType", "decisionRule", "editFormRule", "visitScheduleRule", "taskScheduleRule", "validationRule", "checklistsRule", "taskScheduleRule", "shareRule", "shareTemplateS3Key"]);
|
|
125
|
+
if (resource && "shareTranslations" in resource) {
|
|
126
|
+
form.shareTranslations = resource.shareTranslations && typeof resource.shareTranslations === "object" ? JSON.stringify(resource.shareTranslations) : null;
|
|
127
|
+
}
|
|
128
|
+
return form;
|
|
92
129
|
}
|
|
93
130
|
static associateChild(child, childEntityClass, childResource, entityService) {
|
|
94
131
|
let form = _BaseEntity.default.getParentEntity(entityService, childEntityClass, childResource, "formUUID", Form.schema.name);
|
|
@@ -300,6 +337,18 @@ _defineProperty(Form, "schema", {
|
|
|
300
337
|
taskScheduleRule: {
|
|
301
338
|
type: "string",
|
|
302
339
|
optional: true
|
|
340
|
+
},
|
|
341
|
+
shareRule: {
|
|
342
|
+
type: "string",
|
|
343
|
+
optional: true
|
|
344
|
+
},
|
|
345
|
+
shareTemplateS3Key: {
|
|
346
|
+
type: "string",
|
|
347
|
+
optional: true
|
|
348
|
+
},
|
|
349
|
+
shareTranslations: {
|
|
350
|
+
type: "string",
|
|
351
|
+
optional: true
|
|
303
352
|
}
|
|
304
353
|
}
|
|
305
354
|
});
|