@openmrs/ngx-formentry 3.1.2-pre.189 → 3.1.2-pre.200
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 +82 -2
- package/bundles/openmrs-ngx-formentry.umd.js.map +1 -1
- package/esm2015/form-entry/form-entry.module.js +6 -3
- package/esm2015/form-entry/form-factory/index.js +7 -0
- package/esm2015/form-entry/value-adapters/patient-identifier.adapter.js +76 -0
- package/esm2015/lib/index.js +2 -1
- package/fesm2015/openmrs-ngx-formentry.js +78 -3
- package/fesm2015/openmrs-ngx-formentry.js.map +1 -1
- package/form-entry/form-factory/index.d.ts +6 -0
- package/form-entry/value-adapters/patient-identifier.adapter.d.ts +13 -0
- package/lib/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -16218,6 +16218,83 @@
|
|
|
16218
16218
|
}]
|
|
16219
16219
|
}] });
|
|
16220
16220
|
|
|
16221
|
+
var PatientIdentifierAdapter = /** @class */ (function () {
|
|
16222
|
+
function PatientIdentifierAdapter() {
|
|
16223
|
+
}
|
|
16224
|
+
PatientIdentifierAdapter.prototype.generateFormPayload = function (form, locationUuid) {
|
|
16225
|
+
return this.generateNodePayload(form.rootNode, locationUuid);
|
|
16226
|
+
};
|
|
16227
|
+
PatientIdentifierAdapter.prototype.generateNodePayload = function (rootNode, locationUuid) {
|
|
16228
|
+
var nodes = this.getPatientIdentifierNodes(rootNode);
|
|
16229
|
+
var payload = [];
|
|
16230
|
+
nodes.forEach(function (node) {
|
|
16231
|
+
if (node.control.value !== null &&
|
|
16232
|
+
node.control.value !== undefined &&
|
|
16233
|
+
node.control.value !== '') {
|
|
16234
|
+
payload.push({
|
|
16235
|
+
identifierType: node.question.extras.questionOptions.identifierType,
|
|
16236
|
+
identifier: node.control.value,
|
|
16237
|
+
location: locationUuid,
|
|
16238
|
+
preferred: false
|
|
16239
|
+
});
|
|
16240
|
+
}
|
|
16241
|
+
});
|
|
16242
|
+
return payload;
|
|
16243
|
+
};
|
|
16244
|
+
PatientIdentifierAdapter.prototype.populateForm = function (form, payload) {
|
|
16245
|
+
this.populateNode(form.rootNode, payload);
|
|
16246
|
+
};
|
|
16247
|
+
PatientIdentifierAdapter.prototype.populateNode = function (rootNode, payload) {
|
|
16248
|
+
if (!Array.isArray(payload)) {
|
|
16249
|
+
throw new Error('Expected an array of patient identfiers');
|
|
16250
|
+
}
|
|
16251
|
+
var nodes = this.getPatientIdentifierNodes(rootNode);
|
|
16252
|
+
nodes.forEach(function (node) {
|
|
16253
|
+
payload.forEach(function (element) {
|
|
16254
|
+
if (element.identifierType.uuid ===
|
|
16255
|
+
node.question.extras.questionOptions.identifierType) {
|
|
16256
|
+
if (element.identifier) {
|
|
16257
|
+
node.control.setValue(element.identifier);
|
|
16258
|
+
node.initialValue = element.identifier;
|
|
16259
|
+
}
|
|
16260
|
+
}
|
|
16261
|
+
});
|
|
16262
|
+
});
|
|
16263
|
+
};
|
|
16264
|
+
PatientIdentifierAdapter.prototype.getPatientIdentifierNodes = function (rootNode) {
|
|
16265
|
+
var results = [];
|
|
16266
|
+
this.getPatientIdentifierTypeNodes(rootNode, results);
|
|
16267
|
+
return results;
|
|
16268
|
+
};
|
|
16269
|
+
PatientIdentifierAdapter.prototype.getPatientIdentifierTypeNodes = function (rootNode, array) {
|
|
16270
|
+
var _this = this;
|
|
16271
|
+
if (rootNode.question.extras &&
|
|
16272
|
+
rootNode.question.extras.type === 'patientIdentifier') {
|
|
16273
|
+
array.push(rootNode);
|
|
16274
|
+
}
|
|
16275
|
+
if (rootNode instanceof GroupNode) {
|
|
16276
|
+
var node = rootNode;
|
|
16277
|
+
for (var o in node.children) {
|
|
16278
|
+
if (node.children[o] instanceof NodeBase) {
|
|
16279
|
+
this.getPatientIdentifierTypeNodes(node.children[o], array);
|
|
16280
|
+
}
|
|
16281
|
+
}
|
|
16282
|
+
}
|
|
16283
|
+
if (rootNode instanceof ArrayNode) {
|
|
16284
|
+
var node = rootNode;
|
|
16285
|
+
node.children.forEach(function (child) {
|
|
16286
|
+
_this.getPatientIdentifierTypeNodes(child, array);
|
|
16287
|
+
});
|
|
16288
|
+
}
|
|
16289
|
+
};
|
|
16290
|
+
return PatientIdentifierAdapter;
|
|
16291
|
+
}());
|
|
16292
|
+
PatientIdentifierAdapter.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: PatientIdentifierAdapter, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
16293
|
+
PatientIdentifierAdapter.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: PatientIdentifierAdapter });
|
|
16294
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: PatientIdentifierAdapter, decorators: [{
|
|
16295
|
+
type: i0.Injectable
|
|
16296
|
+
}] });
|
|
16297
|
+
|
|
16221
16298
|
var FormEntryModule = /** @class */ (function () {
|
|
16222
16299
|
function FormEntryModule() {
|
|
16223
16300
|
}
|
|
@@ -16272,7 +16349,8 @@
|
|
|
16272
16349
|
PersonAttribuAdapter,
|
|
16273
16350
|
OrderValueAdapter,
|
|
16274
16351
|
DiagnosisValueAdapter,
|
|
16275
|
-
DebugModeService
|
|
16352
|
+
DebugModeService,
|
|
16353
|
+
PatientIdentifierAdapter
|
|
16276
16354
|
], imports: [[
|
|
16277
16355
|
i1.CommonModule,
|
|
16278
16356
|
i21.ReactiveFormsModule,
|
|
@@ -16349,7 +16427,8 @@
|
|
|
16349
16427
|
PersonAttribuAdapter,
|
|
16350
16428
|
OrderValueAdapter,
|
|
16351
16429
|
DiagnosisValueAdapter,
|
|
16352
|
-
DebugModeService
|
|
16430
|
+
DebugModeService,
|
|
16431
|
+
PatientIdentifierAdapter
|
|
16353
16432
|
],
|
|
16354
16433
|
exports: [
|
|
16355
16434
|
FormRendererComponent,
|
|
@@ -16430,6 +16509,7 @@
|
|
|
16430
16509
|
exports.Option = Option;
|
|
16431
16510
|
exports.OrderValueAdapter = OrderValueAdapter;
|
|
16432
16511
|
exports.Pair = Pair;
|
|
16512
|
+
exports.PatientIdentifierAdapter = PatientIdentifierAdapter;
|
|
16433
16513
|
exports.PersonAttribuAdapter = PersonAttribuAdapter;
|
|
16434
16514
|
exports.QuestionBase = QuestionBase;
|
|
16435
16515
|
exports.QuestionFactory = QuestionFactory;
|